0

我想以编程方式调整表单加载时某些列的大小。这是我的代码:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim resetBtn = New Button With {.Text = "S", .Width = 20}
    dtp.Name = "dtp"
    dtp.Width = 80

    'TODO: This line of code loads data into the 'MakbuzDataSet.makbuzT' table. You can move, or remove it, as needed.
    Me.MakbuzTTableAdapter.Fill(Me.MakbuzDataSet.makbuzT)

    MakbuzTDataGridView.Dock = DockStyle.Bottom

    Me.SavePending = True

    AddHandler dtp.ValueChanged, AddressOf DateTimePicker1_ValueChanged
    FillByTest08ToolStrip.Items.Add(New ToolStripControlHost(dtp))

    FillByTest08ToolStrip.Items.Add(New ToolStripControlHost(resetBtn))

    Button1.Visible = False
    FillByTest08ToolStrip.Margin = New Padding(150, 150, 150, 150)
    FillByTest08ToolStrip.Dock = DockStyle.Top
    MakbuzTDataGridView.Dock = DockStyle.Fill
    MakbuzTDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing
    MakbuzTDataGridView.ColumnHeadersHeight = 75
    MakbuzTDataGridView.EnableHeadersVisualStyles = True

    AddHandler resetBtn.Click, AddressOf onresetBtnClick

    MakbuzTDataGridView.CurrentCell = MakbuzTDataGridView(0, 0)
    MakbuzTDataGridView.TabIndex = 0

    MakbuzVars = Utils.Load(Of Info)("ayarlar.xml")
    MakbuzTDataGridView.Columns(1).Width = 150

End Sub

我正在使用 Visual Studio 2012。如何调整列的大小?

4

0 回答 0