I use Canvas control . in KeyDown event the following code calls the Scroll method whenever the Up, Down, Left, or Right arrow keys are pressed.
Const LeftArrow = 28 Const RightArrow = 29 Const UpArrow = 30 Const DownArrow = 31 Const ScrollUnit = 8 // pixels
Select Case Asc(Key) Case LeftArrow XScroll = XScroll + ScrollUnit Canvas1.Scroll ScrollUnit, 0 Case RightArrow XScroll = XScroll - ScrollUnit Canvas1.Scroll -ScrollUnit, 0 Case UpArrow YScroll = YScroll + ScrollUnit Canvas1.Scroll 0, ScrollUnit Case DownArrow YScroll = YScroll - ScrollUnit Canvas1.Scroll 0, -ScrollUnit End Select
The Scroll method calls the Paint event of the canvas that redraws the picture with the new values of XScroll and YScroll. The Paint event has the following line of code:
g.DrawPicture myPicture,Xscroll,Yscroll
when this Project error
help me Please
|