똑똑해진느낌/VB

[VB] GroupBox BorderLine Color 설정

찐쿵 2019. 8. 26. 14:16

GroupBox에 BorderLine Color 설정이 따로 없어, 직접 Line 그림

    Private Sub GroupBox_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles GroupBox1.Paint
        Dim gfx = e.Graphics
        Dim pen As New Pen(Color.FromArgb(100, 100, 100), 1)

        gfx.DrawLine(pen, 0, 7, e.ClipRectangle.Width - 2, 7) '위쪽라인
        gfx.DrawLine(pen, 0, 7, 0, e.ClipRectangle.Height - 2) '왼쪽라인
        gfx.DrawLine(pen, e.ClipRectangle.Width - 2, 7, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2) '오른쪽라인
        gfx.DrawLine(pen, 0, e.ClipRectangle.Height - 2, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2) '아랫쪽라인
    End Sub