Hi,

I have picture box with some image int it. I want to draw a line on the image. But when code executes, line is there but image is gone.
Here is the code:

bitmap bmp=new bitmap(pb.width,pb.height);
graphics g=new graphics.fromImage(bmp);
pen p=new pen(color.black,5);
g.drawLine(p,0,0,10,10);

Line is there, but underlaying image is gone. What should I do?

Pete

Because you need to paint it there each time the picture is painted most likely

I'm working on application for WinMobile and there isn't OnPaint method there...

Thanks, I have sorted it out.
Another question, do You have any idea how could I drag the image inside pictureBox instead of using scrollbars.

this was covered in another thread - you need to store the picture in memory, and then copy and show only in the picture box what the user is expecting to see

Do You have some example code, plz

Hello,
Please tell me the some references about c#.

Won't the drag and drop method for control work in WM?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.