hey guys,
Please excuse any improper terminology, I'm fairly new to Windows applications in C#. I am trying to create a basic Windows Application with one Form, that will contain a Bitmap Image, however I don't want the whole Form to be the Bitmap Image, a centre Rectangle so to speak.
At this point I have been using a PictureBox which I then 'insert' a Bitmap Image, although it seems over the top with the functionability I want to implement being,
When the user moves over the Image and is pressing the Left Mouse Button, the Bitmap Image is updated to include that point (Set Pixel) with a Black Dot in the Bitmap (similar to that of drawing a curve with the brush in Paint), however the only way I can get it to work so far is to use the following
// There is an event which tests whether or not the left button is pressed and whether the mouse is moving
Bitmap B = new Bitmap(this.MyImageBox.Image, MyImageBoxs_Size)
B.SetPixel(e.X,e.Y, Color.Black) // e = MouseEvent args e
this.MyImageBox.Image = (Image) B;
Would it not be easier if I had some other form of container for the Bitmap Image?? or am I able to have the Bitmap Image sitting directly on the Form with no container at all?? and if so, how do I go about this?
Any guidance would be greatly appreciated,
David
Edit - I'm been doing some research on the net, would it be easier to have a Bitmap on the form (as before within some sort of container or centred in the form) and use a Pen to draw onto the Bitmap?
Loading
Posted Feb 19, 2009, 8:39 PM
If you want to have it just sit on the form, you will need to set the forms BackgroundImage property to the image you desire but if the image is larger than the form it may become distorted. The best way is really by using the PictureBox. At least that way you can set the image anywhere you want and size it to your liking.
LisaPosted Feb 19, 2009, 4:02 AM
you can still place the picturebox in some sort of a panel and work as you want.
even placing it directly on form should work the same as it is placed in a container.
Thanks,
Lisa
David GaleaPosted Feb 19, 2009, 3:15 AM
Can I merely have the Bitmap Image 'sitting' on the form itself at some desired location??
LisaPosted Feb 19, 2009, 3:05 AM
even i think the way you are doing is the correct way.
Its hard to work on it if its inserted into any other container on the Form.
Thanks,
Lisa
Posted Feb 19, 2009, 1:08 AM