ใช้ pen constants (General question) RRS feed


  • ให้ใช้ ReadOnly Property ใน MODULE ที่อยู่ใน NameSpace ค่ะ

    Public Class Form1

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.WindowState = FormWindowState.Maximized
        End Sub

        Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

            e.Graphics.DrawLine(MyPens.FirstPen, 0, Me.Height \ 2, Me.Width, Me.Height \ 2)

        End Sub

    End Class

    Namespace MyPens

        Public Module MyVariables
            Private frst As New System.Drawing.Pen(Color.Black, 2)
            Public ReadOnly Property FirstPen() As System.Drawing.Pen
                    frst.DashStyle = Drawing2D.DashStyle.Dot
                    Return frst
                End Get
            End Property
        End Module

    End Namespace

    Supa Sethasiripong [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • ทำเครื่องหมายเป็นคำตอบโดย supa_sModerator 6 กันยายน 2554 3:43
    5 กันยายน 2554 10:31