Real Software Forums
http://forums.realsoftware.com/

scroll bar Rectangle control
http://forums.realsoftware.com/viewtopic.php?f=1&t=48060
Page 1 of 1

Author:  wittawat [ Mon Jun 03, 2013 10:16 pm ]
Post subject:  scroll bar Rectangle control

Hey, is it possible to add a vertical scroll bar to a Rectangle?

Author:  timhare [ Mon Jun 03, 2013 11:12 pm ]
Post subject:  Re: scroll bar Rectangle control

What would it do? A rectangle is static. Perhaps you should use a canvas instead? Stick a scrollbar control next to the canvas and tie the scrollbar's value changed event to the canvas Scroll method.

Author:  wittawat [ Tue Jun 04, 2013 1:34 am ]
Post subject:  Re: scroll bar Rectangle control

Ask to see samples scrollbar in canvas control.
Thank....

Author:  wittawat [ Tue Jun 04, 2013 3:35 am ]
Post subject:  Re: scroll bar Rectangle control

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

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/