Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
AnswerRe: Process.ProccessName coming up idle in seperate thread. Pin
Anthony Mushrow18-Oct-06 14:24
professionalAnthony Mushrow18-Oct-06 14:24 
GeneralRe: Process.ProccessName coming up idle in seperate thread. Pin
Sunset Towers18-Oct-06 15:10
Sunset Towers18-Oct-06 15:10 
Questionmake a class property an array of an instantiated class? Pin
mmatteson18-Oct-06 11:56
mmatteson18-Oct-06 11:56 
AnswerRe: make a class property an array of an instantiated class? Pin
Christian Graus18-Oct-06 11:59
protectorChristian Graus18-Oct-06 11:59 
GeneralRe: make a class property an array of an instantiated class? Pin
mmatteson19-Oct-06 6:10
mmatteson19-Oct-06 6:10 
AnswerRe: make a class property an array of an instantiated class? Pin
Andrew Rissing18-Oct-06 12:16
Andrew Rissing18-Oct-06 12:16 
GeneralRe: make a class property an array of an instantiated class? Pin
mmatteson18-Oct-06 16:32
mmatteson18-Oct-06 16:32 
QuestionGraphics Pin
Areff18-Oct-06 10:59
Areff18-Oct-06 10:59 
Hi,
I have problem in graphics
in this code no compiletime error occurs.

private void Lines(System.Windows.Forms.PaintEventArgs e)<br />
		{<br />
			Graphics g = e.Graphics;<br />
			Pen pen =  new Pen(Color.Red,4);<br />
                        // draw line from (10,10) to (25,25)<br />
			g.DrawLines(pen,10,10,25,25); <br />
		}


But when i call this method with Onclick event of a button this error occurs in runtime:
"Object refrence not set a instance of an object."

and when i want to use his code
Graphics g = new Graphics();

this error occurs :
No overloaded method 'Graphics' takes '0' arguments

I want to call a method and paint some lines in my form but i dont want to override OnPaint method of form

like this :
protected override void OnPaint(<br />
			PaintEventArgs paintEvent )<br />
		 <br />
		{<br />
			// get graphics object<br />
			Graphics g = paintEvent.Graphics;<br />
			Pen pen =  new Pen(Color.Red,4);<br />
			g.DrawLines(pen,10,10,25,25); <br />
		}


How i can do this ?

---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------

AnswerRe: Graphics Pin
Christian Graus18-Oct-06 11:03
protectorChristian Graus18-Oct-06 11:03 
GeneralRe: Graphics Pin
Areff18-Oct-06 11:12
Areff18-Oct-06 11:12 
GeneralRe: Graphics Pin
Christian Graus18-Oct-06 11:33
protectorChristian Graus18-Oct-06 11:33 
GeneralRe: Graphics Pin
V.19-Oct-06 4:51
professionalV.19-Oct-06 4:51 
AnswerRe: Graphics Pin
V.19-Oct-06 4:50
professionalV.19-Oct-06 4:50 
AnswerRe: Graphics Pin
Bekjong19-Oct-06 5:37
Bekjong19-Oct-06 5:37 
QuestionObjectDisposedException Pin
Yustme18-Oct-06 9:47
Yustme18-Oct-06 9:47 
AnswerRe: ObjectDisposedException Pin
Christian Graus18-Oct-06 10:02
protectorChristian Graus18-Oct-06 10:02 
GeneralRe: ObjectDisposedException Pin
Yustme18-Oct-06 10:23
Yustme18-Oct-06 10:23 
AnswerRe: ObjectDisposedException Pin
Le centriste19-Oct-06 4:23
Le centriste19-Oct-06 4:23 
QuestionPartial Classes - What's The Big Deal? Pin
#realJSOP18-Oct-06 9:22
professional#realJSOP18-Oct-06 9:22 
AnswerRe: Partial Classes - What's The Big Deal? Pin
Andrew Rissing18-Oct-06 9:27
Andrew Rissing18-Oct-06 9:27 
GeneralRe: Partial Classes - What's The Big Deal? Pin
Christian Graus18-Oct-06 10:04
protectorChristian Graus18-Oct-06 10:04 
GeneralRe: Partial Classes - What's The Big Deal? Pin
Andrew Rissing18-Oct-06 11:57
Andrew Rissing18-Oct-06 11:57 
GeneralRe: Partial Classes - What's The Big Deal? Pin
Christian Graus18-Oct-06 11:58
protectorChristian Graus18-Oct-06 11:58 
GeneralRe: Partial Classes - What's The Big Deal? Pin
Andrew Rissing19-Oct-06 5:40
Andrew Rissing19-Oct-06 5:40 
GeneralRe: Partial Classes - What's The Big Deal? Pin
Kevin McFarlane18-Oct-06 12:26
Kevin McFarlane18-Oct-06 12:26 

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.