본문으로 바로가기

(vb.net) DataGridView 머리말 변경

category vb.net 2014. 11. 12. 15:31
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        DataGridView1.ColumnCount = 3


        DataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Navy
        DataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
        DataGridView1.ColumnHeadersDefaultCellStyle.Font = New Font(DataGridView1.Font, FontStyle.Bold)


        DataGridView1.Name = "제품목록"
        DataGridView1.Location = New Point(8, 8)
        DataGridView1.Size = New Size(500, 250)
        'DataGridView1.AutoSizeRowsMode = DataGridView1.AutoSizeRowsMode.DisplayedCellsExceptHeader()


        DataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
        DataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.Single
        DataGridView1.GridColor = Color.Black
        DataGridView1.RowHeadersVisible = False

        'DataGridView1.Columns(0).HeaderText = "코드"
        'DataGridView1.Columns(1).HeaderText = "제품명"
        'DataGridView1.Columns(2).HeaderText = "가격"

        DataGridView1.Columns(0).Name = "코드"
        DataGridView1.Columns(1).Name = "제품명"
        DataGridView1.Columns(2).Name = "가격"

        DataGridView1.Columns(2).DefaultCellStyle.Font = New Font(Me.DataGridView1.DefaultCellStyle.Font, FontStyle.Italic)
        DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        DataGridView1.MultiSelect = False

        DataGridView1.Dock = DockStyle.Fill


    End Sub