Resolved DataGridView Backgroud

Socarsky

Well-known member
Joined
Dec 27, 2012
Messages
173
Location
Jakarta/Indonesia
Programming Experience
Beginner
5jo6.jpg

How can I get that above of DataGridView's appearence?
I want to make the same to mine and hope both they are DataGridView.
Mine is below: I don't mention row's color I mean only whole white backgroud stand still set up. Cell border is none on the pic that ok I can make it.
88bs.jpg
 
Last edited:
So what have you tried and what didn't work? You have opened the MSDN Library and read the documentation for the DataGridView to see what properties it has haven't you? Speaking for myself, I'm more than happy to help people who have tried and weren't able to succeed but I'm not really here to do your work for you so that you don't have to bother trying. You can almost certainly work this out for yourself for the most part at least if you try. Once you have tried, if it doesn't work as you expect then by all means post back and I'll be happy to help you fix it.
 
Actually I found this a few mins ago, and I also thought like you after my post and I also tried to find a delete link before anybody posted something as an answer here but you are faster to reply :) Thanks, can you delete this topic?
7fd9.jpg


VB.NET:
Public Class Form1

    Private Sub SetUpDataGridView()
        Me.Controls.Add(DataGridView1)
        dataGridView1.ColumnCount = 5

        With dataGridView1.ColumnHeadersDefaultCellStyle
            .BackColor = Color.Navy
            .ForeColor = Color.White
            .Font = New Font(dataGridView1.Font, FontStyle.Bold)
        End With

        With dataGridView1
            .EditMode = DataGridViewEditMode.EditOnEnter
            .Name = "dataGridView1"
            .Location = New Point(8, 8)
            .Size = New Size(500, 300)
            .AutoSizeRowsMode = _
                DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
            .ColumnHeadersBorderStyle = _
                DataGridViewHeaderBorderStyle.Raised
            .CellBorderStyle = _
                DataGridViewCellBorderStyle.Single
            .GridColor = SystemColors.ActiveBorder
            .RowHeadersVisible = False

            .Columns(0).Name = "Release Date"
            .Columns(1).Name = "Track"
            .Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(2).Name = "Title"
            .Columns(3).Name = "Artist"
            .Columns(4).Name = "Album"

            ' Make the font italic for row four.
            .Columns(4).DefaultCellStyle.Font = _
                New Font(Control.DefaultFont, _
                    FontStyle.Italic)

            .SelectionMode = _
                DataGridViewSelectionMode.FullRowSelect
            .MultiSelect = False

            .BackgroundColor = Color.Honeydew

            .Dock = DockStyle.Fill
        End With

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        SetUpDataGridView()
    End Sub
End Class
 
Back
Top