Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use GDI in C #, drawing on picture box as shown below. now I want to assign different image in picturebox coordinates then how.help me.

link image
Posted

The PictureBox controls is useless here. Even though you can do it, it would not make any practical sense, as this control won't help you at all. I'll tell you what can you do instead.

Please see my past answers:
Append a picture within picturebox[^],
draw a rectangle in C#[^],
How do I clear a panel from old drawing[^],
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
How to speed up my vb.net application?[^].

—SA
 
Share this answer
 
You can do this one of two ways:

1. Create a Bitmap object that has the size of your picture box, use the Graphics.CreateFromImage() function to allow you to draw on the bitmap (using the DrawImage() function), then assign your Bitmap object as the PictureBox's Image property

2. Alternatively, in the PictureBox.Paint() event, use e.Graphics.DrawImage() to draw your bitmap at any point
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900