Click here to Skip to main content
15,895,283 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cannot read .xls file - microsoft jet database engine could not find the object error Pin
dariusUK28-Apr-09 10:59
dariusUK28-Apr-09 10:59 
Questionsetting height and width of controls in form Pin
mist_psycho25-Apr-09 6:34
mist_psycho25-Apr-09 6:34 
AnswerRe: setting height and width of controls in form Pin
fly90425-Apr-09 7:01
fly90425-Apr-09 7:01 
AnswerRe: setting height and width of controls in form Pin
Luc Pattyn25-Apr-09 7:07
sitebuilderLuc Pattyn25-Apr-09 7:07 
QuestionHow to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 6:06
MohammedMahmoud25-Apr-09 6:06 
AnswerRe: How to make a program like Paint with C# Pin
Luc Pattyn25-Apr-09 6:23
sitebuilderLuc Pattyn25-Apr-09 6:23 
GeneralRe: How to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 6:29
MohammedMahmoud25-Apr-09 6:29 
GeneralRe: How to make a program like Paint with C# Pin
Luc Pattyn25-Apr-09 6:33
sitebuilderLuc Pattyn25-Apr-09 6:33 
Here is my standard advise on painting:

there are several steps to correctly 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 (either add your own paint handler to the Paint event, or
override the OnPaint method) 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.


I trust the CP articles do it this way...

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in


GeneralRe: How to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 6:48
MohammedMahmoud25-Apr-09 6:48 
GeneralRe: How to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 6:58
MohammedMahmoud25-Apr-09 6:58 
GeneralRe: How to make a program like Paint with C# Pin
Luc Pattyn25-Apr-09 7:02
sitebuilderLuc Pattyn25-Apr-09 7:02 
GeneralRe: How to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 8:04
MohammedMahmoud25-Apr-09 8:04 
GeneralRe: How to make a program like Paint with C# Pin
Luc Pattyn25-Apr-09 8:21
sitebuilderLuc Pattyn25-Apr-09 8:21 
GeneralRe: How to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 8:33
MohammedMahmoud25-Apr-09 8:33 
GeneralRe: How to make a program like Paint with C# Pin
Luc Pattyn25-Apr-09 8:48
sitebuilderLuc Pattyn25-Apr-09 8:48 
GeneralRe: How to make a program like Paint with C# Pin
MohammedMahmoud25-Apr-09 8:54
MohammedMahmoud25-Apr-09 8:54 
GeneralRe: How to make a program like Paint with C# Pin
fly90425-Apr-09 9:15
fly90425-Apr-09 9:15 
GeneralRe: How to make a program like Paint with C# Pin
Christian Graus25-Apr-09 11:30
protectorChristian Graus25-Apr-09 11:30 
QuestionProperties error in C# Pin
gopinathtamil25-Apr-09 5:39
gopinathtamil25-Apr-09 5:39 
AnswerRe: Properties error in C# Pin
Luc Pattyn25-Apr-09 5:48
sitebuilderLuc Pattyn25-Apr-09 5:48 
Questionwpf listview row click Pin
netDeveloper25-Apr-09 5:06
netDeveloper25-Apr-09 5:06 
AnswerRe: wpf listview row click Pin
netDeveloper25-Apr-09 6:31
netDeveloper25-Apr-09 6:31 
Questionweb apllication quiz Pin
rudykaka25-Apr-09 4:41
rudykaka25-Apr-09 4:41 
AnswerRe: Web Application Quiz Pin
fly90425-Apr-09 4:56
fly90425-Apr-09 4:56 
GeneralRe: Web Application Quiz Pin
rudykaka26-Apr-09 3:33
rudykaka26-Apr-09 3:33 

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.