Click here to Skip to main content
16,012,028 members
Home / Discussions / C#
   

C#

 
GeneralRe: Call function of Form1 from Form2? Pin
I'm a beginner11-Nov-07 4:32
I'm a beginner11-Nov-07 4:32 
GeneralRe: Call function of Form1 from Form2? Pin
Giorgi Dalakishvili11-Nov-07 5:01
mentorGiorgi Dalakishvili11-Nov-07 5:01 
GeneralRe: Call function of Form1 from Form2? Pin
I'm a beginner11-Nov-07 5:11
I'm a beginner11-Nov-07 5:11 
AnswerRe: Call function of Form1 from Form2? Pin
Colin Angus Mackay11-Nov-07 4:51
Colin Angus Mackay11-Nov-07 4:51 
GeneralRe: Call function of Form1 from Form2? Pin
I'm a beginner11-Nov-07 5:02
I'm a beginner11-Nov-07 5:02 
GeneralRe: Call function of Form1 from Form2? Pin
Colin Angus Mackay11-Nov-07 5:11
Colin Angus Mackay11-Nov-07 5:11 
GeneralRe: Call function of Form1 from Form2? Pin
I'm a beginner11-Nov-07 5:33
I'm a beginner11-Nov-07 5:33 
AnswerRe: Call function of Form1 from Form2? Pin
Luc Pattyn11-Nov-07 6:23
sitebuilderLuc Pattyn11-Nov-07 6:23 
Hi,

this is a standard text on painting, I provide it as a general hint

there are several steps to draw something so it becomes visible on the screen:

1.
decide upon what object you want to draw; it normally is a Control (e.g. a Panel) or a
Form itself. I prefer to add a Panel to a Form, then draw on the Panel.

2.
create some variables (Rectangle, struct, class, whatever) that hold the parameters of
your drawing. For a rectangle that could be top and left coordinate, and width+height,
or just a Rectangle. etc.

3.
create a Paint handler for that Panel, and do all your drawing in there, using the
Graphics class and your variables.

4.
when you want to change things, modify the variables and call Panel.Invalidate() or
one of its overloads (for selective invalidation).

5.
If you want to animate things, perform the move (step 4) inside the Tick handler
of a Windows.Forms.Timer

BTW: if you need to create some objects (Fonts, Pens, Brushes, ...) either keep them
alive in class members (hence create them only once); or create them inside the Paint
handler and don't forget to call Dispose() on them.

Smile | :)


Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google


GeneralRe: Call function of Form1 from Form2? Pin
I'm a beginner11-Nov-07 23:03
I'm a beginner11-Nov-07 23:03 
AnswerRe: Call function of Form1 from Form2? Pin
Christian Graus11-Nov-07 10:15
protectorChristian Graus11-Nov-07 10:15 
GeneralRe: Call function of Form1 from Form2? Pin
I'm a beginner11-Nov-07 23:04
I'm a beginner11-Nov-07 23:04 
Questiona problem related to scroll Pin
Seraph_summer11-Nov-07 2:48
Seraph_summer11-Nov-07 2:48 
AnswerRe: a problem related to scroll Pin
Adeel Chaudhry11-Nov-07 18:15
Adeel Chaudhry11-Nov-07 18:15 
QuestionHow to Interacting with PenTablet.cpl in Vista Pin
I_Need_Help11-Nov-07 1:46
I_Need_Help11-Nov-07 1:46 
QuestionWriting serial port does not work Pin
nasif400311-Nov-07 1:45
nasif400311-Nov-07 1:45 
AnswerRe: Writing serial port does not work Pin
Luc Pattyn11-Nov-07 3:46
sitebuilderLuc Pattyn11-Nov-07 3:46 
Questionhow to check if any textbox has changed on a form? Pin
Cptkli11-Nov-07 1:21
Cptkli11-Nov-07 1:21 
AnswerRe: how to check if any textbox has changed on a form? Pin
Giorgi Dalakishvili11-Nov-07 1:37
mentorGiorgi Dalakishvili11-Nov-07 1:37 
AnswerRe: how to check if any textbox has changed on a form? Pin
Luc Pattyn11-Nov-07 3:48
sitebuilderLuc Pattyn11-Nov-07 3:48 
GeneralRe: how to check if any textbox has changed on a form? Pin
Cptkli11-Nov-07 5:32
Cptkli11-Nov-07 5:32 
GeneralRe: how to check if any textbox has changed on a form? Pin
Giorgi Dalakishvili11-Nov-07 7:58
mentorGiorgi Dalakishvili11-Nov-07 7:58 
QuestionStoring Objects in Treeview Nodes Pin
Adnan Siddiqi10-Nov-07 23:14
Adnan Siddiqi10-Nov-07 23:14 
AnswerRe: Storing Objects in Treeview Nodes Pin
Michael Sync10-Nov-07 23:33
Michael Sync10-Nov-07 23:33 
GeneralRe: Storing Objects in Treeview Nodes Pin
DaveyM6911-Nov-07 6:26
professionalDaveyM6911-Nov-07 6:26 
GeneralRe: Storing Objects in Treeview Nodes Pin
Michael Sync11-Nov-07 14:31
Michael Sync11-Nov-07 14:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.