Re: Drawing in a user control
- From: feripar@xxxxxxxxx
- Date: 28 May 2006 20:18:24 -0700
Thanks Bob and Lloyd; Finally I am using this:
Public Class usrChart
Private DrawingArea As Bitmap
Private Sub usrChart_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
Me.Height = ChartHeight
Me.Width = ChartWidth
DrawingArea = New Bitmap(Me.ClientRectangle.Width,
Me.ClientRectangle.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Private Sub usrChart_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Try
Dim oGraphics As Graphics
oGraphics = e.Graphics
oGraphics.DrawImage(DrawingArea, 0, 0, DrawingArea.Width,
DrawingArea.Height)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Public Sub ShowBandModel(ByRef iCurveNo As Integer, ByRef bolShadow
As Boolean)
Try
Dim iX As Single = 0
Dim iY As Single = 0
Dim oPen As Pen
Dim e1 As Graphics = Graphics.FromImage(DrawingArea)
..............
e1.Dispose()
Me.Invalidate()
End Sub
End Class
And it's working well..... I think....
Bob, what are the differences between use Control or User Control as
base class? and what did you say "Ah, also NEVER create a control that
handles it's own events"?
Thanks,
Fernando.
.
- Follow-Ups:
- Re: Drawing in a user control
- From: feripar
- Re: Drawing in a user control
- References:
- Drawing in a user control
- From: feripar
- Re: Drawing in a user control
- From: Bob Powell [MVP]
- Drawing in a user control
- Prev by Date: Re: Drawing in a user control
- Next by Date: Re: A lost article
- Previous by thread: Re: Drawing in a user control
- Next by thread: Re: Drawing in a user control
- Index(es):
Relevant Pages
|