Community

Question

GDI+ Persistency

I am trying to draw a shapes on one of the control on the form (like panel or picturebox ) by mouse clicks. I am wanting to drawing lines as in the Microsoft Paint; mouse down for starting point, mouse up for end point. I tried to do very simple program as (not by points, by stating their coordinates in public variables):

and when i debug the program i noticed that, although program successfully enter the code inside the paint event of picturebox control, no line was drawn. I could not understand the reason, i controlled the variables x1,y1,x2 and y2 inside the paint event, they are correctly transferred but no drawing can be seen? In addition, when i minimize and maximize the form, only the last drawn line drawn, not lines drawn before. Can anyone help me about this situation? Where is the problem? I read some forums about onpaint event, but i do not understand the "mybase.onpaint", i only want to draw a line on the picturebox control, in object browser, onpaint event for picturebox stated as "ByVal pe As System.Windows.Forms.PaintEventArgs", different than "e". What is the difference i do not understand? Can VB understand that, "pe" for picturebox? If yes, how? I am a beginner to VB, and i use VB 2005, thanks for any help.

All Answers

.. <N/T>

Not N/T now, since editing finished

I was editing my question, since one of my code part was missing and i did not want to confuse people's mind by my wrong code part and start an misguided discussion. My question is there now with right code.

Start or search

Create a new discussion

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

Post type

Subject title

Topic Tags

Select up to 3 tags (1 tag required)

Cloud

Piracy

Security

Apple

Microsoft

IT Employment

Google

Open Source

Mobility

Social Enterprise

Community

Smartphones

Operating Systems

Windows

Mac

Malware

Tablets

Networking

Browser

Hardware

Software

Web Developerment

Linux

Off Topic

Message Body

Track this discussion and email me when there are updates

Please note: Do not post advertisements, offensive material, profanity, or personal attacks. Please remember to be considerate of other members. If you're new to the TechRepublic Forums, please read our TechRepublic Forums FAQ. All submitted content is subject to our Terms Of Use.