打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
DGV设置、绑定图标列表

   '加载主界面表单

    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

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Windows 窗体 DataGridView 控件中的单元格样式
如何用VB在窗体中实现闪烁文字
使用Data控件访问数据库
vb.net入门——FontDialog 组件的使用
DataGridView控件隔行换色
DataGridView隔行变色鼠标经过改变形状及行变色
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服