Quantcast
Viewing all articles
Browse latest Browse all 3874

Invalidate not launching Paint Event from Canvas Object

I created a Canvas Object with 3 Picture Buffers. On the Main Window CanvasI Drawing Lines & Text in Extend P2Buffer() Array Frames when the Canvas Width exceeded. When it’s exceeded I add a Scroll Bar Control. All this code work perfectly with the width scroll Bars the width of the picture (Thanks you Paul Lefebvre in your Xojo Canvas Video).The Problem is when the Cropped Picture to Window2 Canvas2 Which is instantiated from same Canvas Object with XBuffer. The Window2 Canvas2.Invalidate Won’t Launch the Paint Event. Sorry for too many words.

//Canvas Object
Dim P1Buffer, P2Buffer(), XBuffer As Picture

Canvas Object Paint Event
If XBuffer <> Nil Then
  g.DrawPicture(XBuffer, Canvas2.mXScroll, 0)
End If

Crop Method in Window 2
Dim W1, H1, W2, H2, iCrop As Integer
// Paint Event won't Launch

//Calculate unused end tab area to crop off 224 pixels at the end.
iCrop = Window1.Canvas1.Width - (Window1.Canvas1 - 224)

//Resize
W2 = Window1.Canvas1.P2Buffer.Width
H2 = Window1.Canvas1.Height

//Original Size - Minus End Unused Area  iCrop
W1 = Window1.Canvas1.P1Buffer.Width - iCrop
H1 = Window1.Canvas1 P1Buffer.Height

Canvas2.XBuffer = New Picture(W2, H2)
Canvas2.XBuffer.Graphics.DrawPicture(Window1.P2Buffer, _  // Resized Picture load to XBuffer 
0, 0, W2, H2, _  // scaled size
0, 0, W1, H1)   //Original Size

  mXScroll = 0
  HSclBarStaff.Visible = True

//Does Not Launch XBuffer in Paint Event in the Canvas Object. Not to Drawing XBuffer to //Window2 Canvas2 !??? Tried Canvas2.Refresh Too. 
Canvas2.Invalidate

8 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 3874

Trending Articles