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

C#

 
GeneralFunctions and references Pin
surgeproof7-May-04 5:38
surgeproof7-May-04 5:38 
GeneralRe: Functions and references Pin
Heath Stewart7-May-04 9:16
protectorHeath Stewart7-May-04 9:16 
GeneralRe: Functions and references Pin
surgeproof7-May-04 23:16
surgeproof7-May-04 23:16 
GeneralRe: Functions and references Pin
Heath Stewart8-May-04 19:20
protectorHeath Stewart8-May-04 19:20 
GeneralRe: Functions and references Pin
surgeproof10-May-04 4:50
surgeproof10-May-04 4:50 
GeneralWorking with XML file Pin
Alex Getman7-May-04 5:35
Alex Getman7-May-04 5:35 
GeneralRe: Working with XML file Pin
TigerNinja_7-May-04 8:35
TigerNinja_7-May-04 8:35 
GeneralSystem.Drawing Problem Pin
Russell Jones7-May-04 4:29
Russell Jones7-May-04 4:29 
I'm really confused.

I'm new to forms in c#, but i have used c# and forms before, just not together.

i want to draw a rectangle on the screen so i used this code in a button click event

Pen NewPen = new Pen(Color.Red,10);
Graphics g = this.CreateGraphics();
g.DrawRectangle(NewPen,200,200, 50,50);

this does exactly what i would expect, but it's not very interesting so i added some lines:

Pen NewPen = new Pen(Color.Red,10);
Graphics g = this.CreateGraphics();
int X = this.Width/2;
int Y = this.Height-100;
g.DrawRectangle(NewPen,X,Y, 50,50);
Now i don't get the rectangle, but if i step through the code i can see a flash as it gets drawn and then when the form is displayed it dissappears.

I revert to the original code and now that doesn't work either, but if i paste the code into a new project it works fine.

has anyone seen anything like this before?

I'm really confused, any help would be appreciated

russ
GeneralRe: System.Drawing Problem Pin
Mike Dimmick7-May-04 4:48
Mike Dimmick7-May-04 4:48 
GeneralRe: System.Drawing Problem Pin
Heath Stewart7-May-04 4:51
protectorHeath Stewart7-May-04 4:51 
GeneralRe: System.Drawing Problem Pin
Russell Jones10-May-04 3:33
Russell Jones10-May-04 3:33 
GeneralString Pin
bertcox7-May-04 3:17
bertcox7-May-04 3:17 
GeneralRe: String Pin
Heath Stewart7-May-04 3:31
protectorHeath Stewart7-May-04 3:31 
GeneralRe: String Pin
Jeff Varszegi7-May-04 4:20
professionalJeff Varszegi7-May-04 4:20 
GeneralRe: String Pin
Heath Stewart7-May-04 4:25
protectorHeath Stewart7-May-04 4:25 
GeneralRe: String Pin
Jeff Varszegi7-May-04 4:45
professionalJeff Varszegi7-May-04 4:45 
GeneralRe: String Pin
Heath Stewart7-May-04 4:47
protectorHeath Stewart7-May-04 4:47 
GeneralRe: String Pin
Bitwise Gamgee10-May-04 4:51
Bitwise Gamgee10-May-04 4:51 
GeneralAdvance Toolbar control in C# Pin
lawtoyou7-May-04 1:03
lawtoyou7-May-04 1:03 
GeneralRe: Advance Toolbar control in C# Pin
Heath Stewart7-May-04 3:24
protectorHeath Stewart7-May-04 3:24 
GeneralRe: Advance Toolbar control in C# Pin
lawtoyou7-May-04 3:33
lawtoyou7-May-04 3:33 
GeneralRe: Advance Toolbar control in C# Pin
Heath Stewart7-May-04 3:41
protectorHeath Stewart7-May-04 3:41 
GeneralMobile phone controlling... Pin
mikker_1236-May-04 23:34
mikker_1236-May-04 23:34 
GeneralRe: Mobile phone controlling... Pin
Heath Stewart7-May-04 3:17
protectorHeath Stewart7-May-04 3:17 
GeneralRe: Mobile phone controlling... Pin
OMalleyW7-May-04 4:56
OMalleyW7-May-04 4:56 

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.