减少 DatagridView 面板中的间隙

Reducing gap in the DatagridView's panel

提问人:agaesh kumar 提问时间:10/3/2023 最后编辑:jmcilhinneyagaesh kumar 更新时间:10/3/2023 访问量:34

问:

看截图

蓝色面板内部的 dgv 应最大化,没有任何间隙

Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
    If Not ValidateInput(CtrlDtl) Then Return
    If Not ValidateAddItem() Then Return

    AddRecord()
    ClearDetails()
    CalculateTotal()
    txtAmtWithGst.Select()

    With PanelDgvDocDtl
        .Size = New Size(dgvKnockOff.Width * 0.415, dgvKnockOff.Height - 24)
        Panel2.Height = .Height
        .Location = New Point(dgvKnockOff.Right - PanelDgvDocDtl.Width, pnlTop.Height + 25)
        .BringToFront()
    End With

    'this is my code that set size and location for the dgv

    PanelDgvDocDtl.Visible = True
    If dgvDocDtl.Rows.Count > 1 Then cmbBranchCode.Enabled = False

    clearMode = False 'setting the clear mode false to prevent certain control from being cleared, 
    Clear() 'maybe there is a better way to handle this
    clearMode = True 'setting it true. so the clear() method can clear all the controls it has. for other flow - agaesh

    pnlTotal.Visible = True
End Sub
vb.net 基本

评论

0赞 jmcilhinney 10/3/2023
请在提交前查看问题的预览,如果格式混乱,请不要提交。另外,你似乎上传了一张图片,但不是看不见,那有什么用呢?在发布问题之前,确保您的问题看起来正确并不难。
0赞 jmcilhinney 10/3/2023
与任何子控件一样,可以使用 and 属性来控制它相对于其父控件的大小调整方式。如果希望网格的边缘与父容器的边缘保持固定距离,请在设计器中设置该间距,然后将属性设置为包含该边缘。简单。DockAnchorAnchor

答: 暂无答案