This code moves a large image by dragging the mouse (the file is also attached):
Code:
Sub Globals Dim x1,y1 Dim maxX,maxY End Sub
Sub App_Start Form1.Show drawer.New1("form1",false) bmpMap.New1("pic.jpg") 'Loads the image to a Bitmap object rectDest.New1(5,5,form1.Width-10,form1.Height-10) 'The form's rectangle rectSrc.New1(0,0,rectDest.Width,rectDest.Height) 'The bitmap's rectangle maxX = bmpMap.Width - rectDest.Width maxY = bmpMap.Height - rectDest.Height DrawMap End Sub
Sub Form1_MouseDown (x,y) x1 = x y1 = y End Sub
Sub Form1_MouseUp (x,y) RectSrc.X = Min(maxX,Max(RectSrc.X - x + x1,0)) 'Checks the bounds and updates the coordinates RectSrc.Y = Min(maxY,Max(RectSrc.Y - y + y1,0)) DrawMap End Sub
Sub DrawMap drawer.DrawImage1(bmpMap.Value,rectSrc.Value,rectDest.Value,false) drawer.Refresh2(rectDest.Value) End Sub
I had a look at your example. In this case are the LargeChange, SmallChange and Value parameters also accessible and be changed ?
Yes, they should be accessible through the HorizontalScroll and VerticalScroll properties of the Panel which are HScrollProperties and VScrollProperties types respectively. If you walk the Docs for Panel you should see them and their members.
Code:
pnl1obj.FromControl("Panel1") pnl1obj.SetProperty("AutoScroll", true) hscrollobj.value = pnl1obj.GetProperty("HorizontalScroll") ' returns an HScrollProperties type hscrollobj.SetProperty("LargeChange", 20)
Quote:
The landing of the F111 is somewhat risky, isn't it ?
It's an Autralian one that sustained undercarriage damage on takeoff. They nearly dumped it in the sea but opted to belly it in after lightening it as much as possible. Surprisingly little damage was caused apparently!
is it possible to add the ValueChanged event to the panel's scrollbars
Unfortunately it looks like no .
The Door library can see two scroll bar property objects but not the scroll bars themselves. This is because the Panel is a native control, and so are its' scroll bars and the scroll bars are not exposed as .NET controls - only the Panel itself is. There is a Scroll event for the panel for the desktop but not on the device. However even on the desktop this event can't be used as the Door library doesn't know about the ScrollEventHandler object which this event returns.
EDIT : Note that if you want to try this on the device that Line 14 should be changed to "MouseDown", as a Panel does not have a MouseClick event on the device, and lines 19,20 and 21 removed as on the device a Panel does not have HorizontalScroll and VerticalScroll properties. The scroll events will work.