以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 自定义登录窗口问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=135446) |
-- 作者:ZJZK2018 -- 发布时间:2019/5/27 9:12:00 -- 自定义登录窗口问题 我做好了一个自定义登录窗口,发现用户名中无法用中文输入? 1、窗口AfterLoad Dim cmd As New SQLCommand Dim dt As DataTable Dim cmb As WinForm.ComboBox = e.Form.Controls("cmbox_Name") cmd.ConnectionName = V cmd.CommandText = "SELECT DISTINCT Name Fro m {Users} Where 启用 = 1" dt = cmd.ExecuteReader() For Each dr As DataRow In dt.Datarows cmb.Items.Add(dr("Name")) Next cmb.SelectedIndex = 0 Dim sf As String = GetConfigValue("Savepsw","") If sf > "" Then Dim arr() As String = sf.Split("|") e.Form.Controls("chbox1").Checked = arr(0) = 1 e.Form.Controls("cmbox_Name").Text = arr(1) e.Form.Controls("txt_Password").Text = arr(2) End If If e.Form.Controls("cmbox_Name").Text = "" OrElse e.Form.Controls("chbox1").Checked = False Then e.Form.Controls("txt_Password").Text = "" End If If e.Form.Controls("txt_Password").Text > "" Then e.Form.Controls("txt_Password").PasswordChar = "*" End If 2、用户名ValueChanged Dim nm As String = DataTables("Users").SQLGetComboListString("Name","启用 = 1") Dim str As String = GetConfigValue("name","") e.Form.Controls("txt_Password").Text = "" If e.Form.Controls("cmbox_Name").Text = "" Then e.Form.Controls("txt_Password").Text = "" Else If nm.Contains(e.Sender.Value) = False Then Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) e.Form.Controls("cmbox_Name").Text = "" Return Else If str.Contains(e.Sender.Value) = False AndAlso nm.Contains(e.Sender.Value) Then SaveConfigValue("name",str & "|" & e.Sender.Value) End If End If End If e.Sender.ComboList = GetConfigValue("name","")
[此贴子已经被作者于2019/5/27 9:37:37编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/5/27 9:45:00 --
你把控件放在picturebox容器里面吧?如果是,请不要这样做。
方法一:直接设置窗口背景图片,不用picturebox。
方法二:把容器让在picturebox外面,删除picturebox,然后移动好控件,再添加picturebox,设置停靠fill,最低层false。
|
-- 作者:ZJZK2018 -- 发布时间:2019/5/30 15:56:00 -- 我采用自定义登录界面,下面红色代码不起作,如何调整? LoadUserSetting事件: \'菜单管理 If _UserGroup = "财务部" OrElse User.Type = UserTypeEnum.Developer Then RibbonTabs("工资社保管理").Visible = True RibbonTabs("人事管理").Visible = True RibbonTabs("账务管理").Visible = True Else RibbonTabs("工资社保管理").Visible = False RibbonTabs("人事管理").Visible = False RibbonTabs("账务管理").Visible = False End If 登录窗口中“确定”按钮代码: Dim UserName As String = e.Form.Controls("cmbox_Name").Value Dim cmd As New SQLCommand Dim dt As DataTable Dim dr As DataRow cmd.ConnectionName = V If UserName = "" Then Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If cmd.CommandText = "Select * Fro m {Users1} Where [Name] = \'" & UserName & "\' And 启用 = 1" dt = cmd.ExecuteReader If dt.DataRows.Count = 0 Then Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If dr = dt.DataRows(0) If e.Form.Controls("txt_Password").Value = dr("Password") Then _UserName = UserName _UserGroup = dr("Group") SaveConfigValue("Savepsw",IIF(e.Form.Controls("chbox1").Checked,1,0) & "|" & UserName & "|" & dr("Password")) Forms("默认").Open e.Form.Close Else Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) e.Form.Controls("txt_Password").Select() e.Form.Controls("txt_Password").Value = Nothing End If [此贴子已经被作者于2019/5/30 15:58:57编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/5/30 16:07:00 --
LoadUserSetting事件代码,写到登陆按钮click事件,即可。
|