From: David D Webb on 25 Jan 2006 16:53 I am trying to scroll a picture larger than the screen. I have a form with a panel on it (240H). On this panel, I have a picture box that is larger than the panel (960H). I have a vertical scroll bar on the form next to the panel. Changing the scrollbar moves the picture box up and the panel defines the viewing area: this.pboxWeekCal.Top = -(this.vScrollBar.Value * 40); Now, I didn't think the picture box would handle the clipping and redrawing correctly. But I thought it would only have a blank area where the new region came into view from the scrolling. What is happening though, is the entire picturebox goes blank by just moving the scrollbar one change value. Is the default paint event wiping it clear or something like that? Is there a better way to do this. I have an offscreen bitmap that I can buffer from, and worse case scenario, I'll redraw the entire viewable region for every scroll change - in that case I'll just get rid of the picturebox and copy onto the first panel directly. Thanks, Dave Using Visual Studio 2003 and .NET CF sp2.
From: Alex Yakhnin [MVP] on 25 Jan 2006 20:42 It's already been done. Take a look at the ImageViewer control: http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=e0786a7b-935c-4e46-b6c5-0100af4bcf47 -- Alex Yakhnin, .NET CF MVP www.intelliprog.com | www.opennetcf.org "David D Webb" <spivey(a)nospam.post.com> wrote in message news:uAzwWnfIGHA.3856(a)TK2MSFTNGP12.phx.gbl... >I am trying to scroll a picture larger than the screen. > > I have a form with a panel on it (240H). On this panel, I have a picture > box that is larger than the panel (960H). I have a vertical scroll bar on > the form next to the panel. Changing the scrollbar moves the picture box > up and the panel defines the viewing area: > this.pboxWeekCal.Top = -(this.vScrollBar.Value * 40); > > Now, I didn't think the picture box would handle the clipping and > redrawing correctly. But I thought it would only have a blank area where > the new region came into view from the scrolling. What is happening > though, is the entire picturebox goes blank by just moving the scrollbar > one change value. Is the default paint event wiping it clear or something > like that? Is there a better way to do this. I have an offscreen bitmap > that I can buffer from, and worse case scenario, I'll redraw the entire > viewable region for every scroll change - in that case I'll just get rid > of the picturebox and copy onto the first panel directly. > > Thanks, > > Dave > > Using Visual Studio 2003 and .NET CF sp2. > > > > >
From: David D Webb on 26 Jan 2006 09:36 Thanks Alex, that confirms my thoughts on having to double buffer with the offscreen bitmap and redraw the entire viewable area on each scroll movement. Would a custom control work any faster than just using a panel on a form? (besides the re-usability factor) Thanks, Dave "Alex Yakhnin [MVP]" <a.yakhnin(a)online.att.net> wrote in message news:eeyuxmhIGHA.1388(a)TK2MSFTNGP11.phx.gbl... > It's already been done. Take a look at the ImageViewer control: > > http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=e0786a7b-935c-4e46-b6c5-0100af4bcf47 > > -- > Alex Yakhnin, .NET CF MVP > www.intelliprog.com | www.opennetcf.org > > "David D Webb" <spivey(a)nospam.post.com> wrote in message > news:uAzwWnfIGHA.3856(a)TK2MSFTNGP12.phx.gbl... >>I am trying to scroll a picture larger than the screen. >> >> I have a form with a panel on it (240H). On this panel, I have a picture >> box that is larger than the panel (960H). I have a vertical scroll bar >> on the form next to the panel. Changing the scrollbar moves the picture >> box up and the panel defines the viewing area: >> this.pboxWeekCal.Top = -(this.vScrollBar.Value * 40); >> >> Now, I didn't think the picture box would handle the clipping and >> redrawing correctly. But I thought it would only have a blank area where >> the new region came into view from the scrolling. What is happening >> though, is the entire picturebox goes blank by just moving the scrollbar >> one change value. Is the default paint event wiping it clear or something >> like that? Is there a better way to do this. I have an offscreen bitmap >> that I can buffer from, and worse case scenario, I'll redraw the entire >> viewable region for every scroll change - in that case I'll just get rid >> of the picturebox and copy onto the first panel directly. >> >> Thanks, >> >> Dave >> >> Using Visual Studio 2003 and .NET CF sp2. >> >> >> >> >> > >
From: Alex Yakhnin [MVP] on 26 Jan 2006 09:59 Yes, I think the control has a satisfactory drawing speed. -- -- Alex Yakhnin, .NET CF MVP www.intelliprog.com | www.opennetcf.org "David D Webb" wrote: > Thanks Alex, that confirms my thoughts on having to double buffer with the > offscreen bitmap and redraw the entire viewable area on each scroll > movement. Would a custom control work any faster than just using a panel on > a form? (besides the re-usability factor) > > Thanks, > Dave > > > "Alex Yakhnin [MVP]" <a.yakhnin(a)online.att.net> wrote in message > news:eeyuxmhIGHA.1388(a)TK2MSFTNGP11.phx.gbl... > > It's already been done. Take a look at the ImageViewer control: > > > > http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=e0786a7b-935c-4e46-b6c5-0100af4bcf47 > > > > -- > > Alex Yakhnin, .NET CF MVP > > www.intelliprog.com | www.opennetcf.org > > > > "David D Webb" <spivey(a)nospam.post.com> wrote in message > > news:uAzwWnfIGHA.3856(a)TK2MSFTNGP12.phx.gbl... > >>I am trying to scroll a picture larger than the screen. > >> > >> I have a form with a panel on it (240H). On this panel, I have a picture > >> box that is larger than the panel (960H). I have a vertical scroll bar > >> on the form next to the panel. Changing the scrollbar moves the picture > >> box up and the panel defines the viewing area: > >> this.pboxWeekCal.Top = -(this.vScrollBar.Value * 40); > >> > >> Now, I didn't think the picture box would handle the clipping and > >> redrawing correctly. But I thought it would only have a blank area where > >> the new region came into view from the scrolling. What is happening > >> though, is the entire picturebox goes blank by just moving the scrollbar > >> one change value. Is the default paint event wiping it clear or something > >> like that? Is there a better way to do this. I have an offscreen bitmap > >> that I can buffer from, and worse case scenario, I'll redraw the entire > >> viewable region for every scroll change - in that case I'll just get rid > >> of the picturebox and copy onto the first panel directly. > >> > >> Thanks, > >> > >> Dave > >> > >> Using Visual Studio 2003 and .NET CF sp2. > >> > >> > >> > >> > >> > > > > > > >
From: David D Webb on 27 Jan 2006 10:09 Converting my code from the panel in a form to a custom control worked considerably better. Being able to override the OnPaintBackground event eliminates the flicker you get in the panel when scrolling. Double buffering with an offscreen bitmap and clipping the rectangle to update the viewable area on the OnPaint event of the control works very smoothly. If anyone ever needs a (very rough) control for a simple Pocket Outlook type viewer, let me know. -Dave spivey@[no spam].post.com
|
Pages: 1 Prev: SetPowerRequirement Next: Install .net Framework 2.0.50727 |