I have a user control class, on which I am creating a graphics object and drawing.
I am creating the graphics object, g, as a global variable:
when I draw using this graphics object, for example:
It crops it at 150x150 pixels. My assumption is that using "me.creategraphics()" means that the graphics object is only of size 150x150, despite the fact that the usercontrol is larger.
I noticed that 150x150 is the default size when you add a usercontrol, although changing the size in design view or Windows Form Designer code makes no difference, it always crops there.
If I create the graphics object from e.graphics in the overriden paint event:
then no crop occurs. However I need to access the graphics object from other procedures, for setting properties and the like.
Thanks in advance for any help
I am creating the graphics object, g, as a global variable:
VB.NET:
Dim g As Graphics = Me.CreateGraphics
when I draw using this graphics object, for example:
VB.NET:
g.FillEllipse(mybrush, New RectangleF(2, 2, 240, 240))
It crops it at 150x150 pixels. My assumption is that using "me.creategraphics()" means that the graphics object is only of size 150x150, despite the fact that the usercontrol is larger.
I noticed that 150x150 is the default size when you add a usercontrol, although changing the size in design view or Windows Form Designer code makes no difference, it always crops there.
If I create the graphics object from e.graphics in the overriden paint event:
VB.NET:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics = e.Graphics
End Sub
then no crop occurs. However I need to access the graphics object from other procedures, for setting properties and the like.
Thanks in advance for any help