'加载主界面表单 Private Sub FormMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load With Me.DGV_GpHqFind .EnableHeadersVisualStyles = False '行标题和列标题是否使用用户当前主题式样 .ColumnHeadersDefaultCellStyle.Font = New Font("微软雅黑", 10, FontStyle.Regular) '标题字体 .RowsDefaultCellStyle.Font = New Font("微软雅黑", 10, FontStyle.Regular) '表格字体 .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter '标题居中 .RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight '表格文字靠右对齐 .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells '设定包括Header和所有单元格的列宽自动调整 .AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells '设定包括Header和所有单元格的行高自动调整 .ColumnHeadersDefaultCellStyle.ForeColor = Color.MidnightBlue '设定标题栏字体颜色 .ColumnHeadersDefaultCellStyle.BackColor = Color.AliceBlue '设定标题栏背景颜色 '.Columns(5).DefaultCellStyle.ForeColor = Color.Red '设定第5列的字体颜色 '.Columns(4).DefaultCellStyle.BackColor = Color.Blue '设定第5列的字体颜色 '.Rows(2).DefaultCellStyle.ForeColor = Color.Red '设定第2行的字体颜色 '.Rows(2).DefaultCellStyle.BackColor = Color.Blue '设定第2行的背景颜色 '.Item(6, 2).Style.BackColor = Color.FromArgb(255, 180, 255) '设定指定单元格背景颜色 '.Item(3, 0).Style.ForeColor = Color.FromArgb(0, 240, 80) '设定指定单元格字体颜色 '.Columns(4).SortMode = DataGridViewColumnSortMode.Programmatic '排序模式 .AllowUserToAddRows = False '不显示最下面的新行 End With Menu_Main.Location = New Point(0, 0) '主菜单位置 Tools_Main.Location = New Point(3, 27) '主工具栏位置 Tools_Sub.Location = New Point(Tools_Main.Width + 5, 27) '次工具栏位置 '绑定图标列表 For i = 0 To Tools_Main.Items.Count - 1 If Not Tools_Main.Items(i).GetType.Name = "ToolStripLabel" Then 'ToolStripButton Tools_Main.Items(i).Image = ImageListTools_Main.Images.Item(i) End If Next For i = 0 To Tools_Sub.Items.Count - 1 If Not Tools_Sub.Items(i).GetType.Name = "ToolStripLabel" Then Tools_Sub.Items(i).Image = ImageListTools_Sub.Images.Item(i + 5) End If Next End Sub |
|
来自: *蓝星* > 《 VB 2015》