Re: scroll bars on a panel ?
Are you drawing the image to the panel, or to a picturebox which gets added to the panel?.... Because if you're drawing it to the panel directly, then you need to go back and review how the AutoScroll property works. ;)
Re: scroll bars on a panel ?
AceInfinity's solution is essentially correct. Basically you draw to an object (e.g. a picturebox) that the panel contains and then change the location of that object (the coordinates of which are relative to the upper-left corner of the panel, not the form). GDI should take care of the rest of the drawing automagically, I think (been awhile since I did that). Note that you're not going to get amazing performance out of WinForms, but it may be adequate, depending on your purposes.
Re: scroll bars on a panel ?
Put the image to the PictureBox, make the dimensions of the PictureBox no more and no less from the actual control's size, then place the PictureBox at (0, 0) within the panel, and make sure its AutoScroll property is set to true. The panel is a container for controls, so the picturebox actually needs to be added as a child control to the panel.
Re: scroll bars on a panel ?
Quote:
Originally Posted by
AceInfinity
make the dimensions of the PictureBox no more and no less from the actual control's size
To clarify: you set the PictureBox to the size of the drawing canvas (image size), not to the size of the panel. Correct?
Re: scroll bars on a panel ?
Quote:
Originally Posted by
BioPhysEngr
To clarify: you set the PictureBox to the size of the drawing canvas (image size), not to the size of the panel. Correct?
Yeah, I meant to say "Picture" I have this auto-completion addon that turned it into "PictureBox" because it was previously typed.
Re: scroll bars on a panel ?
many thanks for the replies, i will have to go back and adjust accordingly.
what do you suggest as the best route for doing multiple layers onto the image ? i.e. 4 seperate layers combined into on. from a speed point of view.
thanks
Re: scroll bars on a panel ?
Depends on what you mean by "Layers", new images? Or images painted over the image in one picturebox?
Re: scroll bars on a panel ?
i was thinking along the lines of 3-5 independant bmp's all the same dimensions layered together. i would imagine it nees some sort of masking applid and if so is it built in or do i need to code it.
it has been 4+ years since i did any coding in c# and then i had only been looking at it for 6 months, so bear with me if i sound a little naive here.
thanks
Re: scroll bars on a panel ?
layered together how? You need to define what you mean by 'layer' as mentioned before. In separate PictureBox's? In the same image within one PictureBox?
Re: scroll bars on a panel ?
sorry should have been clearer, as i said between 3- 5 bmps merged down to a single bmp, transferred to the panel for the purpose of when the panel scrolls.
im just playing with ideas here, in advance, as im messing about with some lync 2010 code at the same time and the two are vastly different :( . i am still contemplating taking the whole thing into XNA.
as that fits more with some 3d stuff im doing in softimage,autodesk apps in general, not enough hours ina day though :S
thanks
Re: scroll bars on a panel ?
XNA? It's limited though mainly towards gaming.
For a PictureBox you could take the image out and modify it with GDI before assigning it back to the PictureBox quite easily to layer images into 1. Once you do that though, you can't just "remove" a layer, you have to save the previous image in memory or to the filesystem or something to have something to "revert" back to if that was the case.
This is what I did for my watermark program a while ago.