kulfanumber
Programmer
Hi, How can i declare a system.drawing.graphics variable. when i declare it as
Dim a as System.Drawing.Graphics it gives null exception.
Dim a as System.Drawing.Graphics it gives null exception.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub New()
Me.SetStyle(Windows.Forms.ControlStyles.AllPaintingInWmPaint, True)
[green]Me.SetStyle(Windows.Forms.ControlStyles.UserPaint, True)[/green]
Me.SetStyle(Windows.Forms.ControlStyles.OptimizedDoubleBuffer, True)
Me.SetStyle(Windows.Forms.ControlStyles.ResizeRedraw, True)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
Dim rect As New Rectangle(Me.Location, Me.Size)
rect.Inflate(1, 1)
g.DrawRectangle(Pens.Black, rect)
MyBase.OnPaint(e)
End Sub
Public Sub New()
Me.BorderStyle = Windows.Forms.BorderStyle.None
Me.SetStyle(Windows.Forms.ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(Windows.Forms.ControlStyles.UserPaint, True)
Me.SetStyle(Windows.Forms.ControlStyles.OptimizedDoubleBuffer, True)
Me.SetStyle(Windows.Forms.ControlStyles.ResizeRedraw, True)
Me.SetStyle(ControlStyles.UseTextForAccessibility, True)
End Sub