Public Class 控件代码
Public Class 控件代码 '全局变量 - TrackBar1 改变图片大小使用 Dim l As Double Dim t As Double #Region "时间控件 标签控件 链接标签控件 日期控件 下拉菜单控件 " '窗体的设置 Private Sub 控件代码_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '设置时间控件启用 Timer1.Enabled = True '设置窗体不可改变大小 Me.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink '设置窗体启动居中 Me.StartPosition = FormStartPosition.CenterScreen '设置窗体启动最大/最小化 'Me.WindowState = FormWindowState.Maximized / FormWindowState.Minimized '启动自动加载listbox1项目 '调用方法 加载listbox选项 SelectItems() '設定DataGridView1滿屏 DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill '加载树形菜单视图 LoadTreeView() 'ComboBox1 启动加载选项 '启动清空 ComboBox1 ComboBox1.Items.Clear() Me.ComboBox1.Items.Add("ComboBox1启动加载选项") Dim strSql As String = "SELECT EmpID FROM VWEmployees" Dim ds As DataSet = GetDataSet(strSql) If ds.Tables.Item(0).Rows.Count = 0 Then MessageBox.Show("资料不存在") Else For i As Integer = 0 To ds.Tables.Item(0).Rows.Count - 1 Me.ComboBox1.Items.Add(ds.Tables.Item(0).Rows(i).Item(0)) Next ComboBox1.SelectedIndex = 0 End If '记录画面起始值 - 距左侧 顶部的距离 l = PictureBox1.Location.X.ToString() t = PictureBox1.Location.Y.ToString() End Sub '时间控件的设置 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick TextBox1.Text = Now & " 系统时间" End Sub '链接标签的用法 - 两种打开方式 Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked '启动的是默认浏览器 - 推荐使用 System.Diagnostics.Process.Start("http://www.baidu.com/") 'Shell("explorer.exe http://www.baidu.com/") End Sub #End Region
用户评论