Click here to Skip to main content
15,887,346 members
Home / Discussions / C#
   

C#

 
GeneralRe: stop a thread Pin
George_George22-Apr-08 16:23
George_George22-Apr-08 16:23 
QuestionC# Drawing question Pin
oliversimon21-Apr-08 23:12
oliversimon21-Apr-08 23:12 
GeneralRe: C# Drawing question Pin
Reelix22-Apr-08 0:09
Reelix22-Apr-08 0:09 
GeneralRe: C# Drawing question Pin
oliversimon22-Apr-08 0:34
oliversimon22-Apr-08 0:34 
GeneralRe: C# Drawing question Pin
Anthony Mushrow22-Apr-08 1:35
professionalAnthony Mushrow22-Apr-08 1:35 
GeneralRe: C# Drawing question Pin
Reelix22-Apr-08 1:55
Reelix22-Apr-08 1:55 
GeneralRe: C# Drawing question Pin
Anthony Mushrow22-Apr-08 2:00
professionalAnthony Mushrow22-Apr-08 2:00 
GeneralRe: C# Drawing question Pin
oliversimon22-Apr-08 2:45
oliversimon22-Apr-08 2:45 
First off, thanks to you both for the replies and the good news is that I think I have it sorted:

I inserted

Invalidate();
Update();

into the loop that updates the ball's position and it works (although a bit flickery even with Reelix's anti-flicker code but that's not really important).

As far as I can make out these two force the Form to redraw so I suppose that they trigger an OnPaint() event:

protected override void OnPaint(PaintEventArgs paintEvnt)
{
formPaint(paintEvnt);
}

which calls the Form's paint method

private void formPaint(PaintEventArgs e)
{

Graphics g = e.Graphics;
aBall.Paint(g);
aBall2.Paint(g);

}

which in turn calls the Ball's paint method:

public void Paint(Graphics g)
{
// System.Drawing.Graphics gx = new Graphics();
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Tomato);
g.DrawEllipse(myPen, this.XPos, this.YPos, 10, 10);
}

Any comments / corrections / better suggestions are welcomed

Thanks again,
Si
QuestionCompare SortedList problem. Pin
dennycrane21-Apr-08 23:06
dennycrane21-Apr-08 23:06 
GeneralRe: Compare SortedList problem. Pin
Gopal.S22-Apr-08 0:52
Gopal.S22-Apr-08 0:52 
GeneralRe: Compare SortedList problem. Pin
dennycrane22-Apr-08 1:11
dennycrane22-Apr-08 1:11 
QuestionRetrieve Objects from ArrayList.. Pin
ptr2void21-Apr-08 22:57
ptr2void21-Apr-08 22:57 
GeneralRe: Retrieve Objects from ArrayList.. Pin
phannon8621-Apr-08 23:19
professionalphannon8621-Apr-08 23:19 
GeneralRe: Retrieve Objects from ArrayList.. Pin
ptr2void21-Apr-08 23:42
ptr2void21-Apr-08 23:42 
GeneralRe: Retrieve Objects from ArrayList.. Pin
phannon8621-Apr-08 23:54
professionalphannon8621-Apr-08 23:54 
GeneralRe: Retrieve Objects from ArrayList.. Pin
Pete O'Hanlon22-Apr-08 0:50
mvePete O'Hanlon22-Apr-08 0:50 
Questionhow to configure via app.config Pin
stephan_00721-Apr-08 22:35
stephan_00721-Apr-08 22:35 
QuestionHow can I convert generic list? Pin
marekS08221-Apr-08 21:56
marekS08221-Apr-08 21:56 
AnswerRe: How can I convert generic list? [modified] Pin
phannon8621-Apr-08 22:11
professionalphannon8621-Apr-08 22:11 
AnswerRe: How can I convert generic list? Pin
silbarad21-Apr-08 22:22
silbarad21-Apr-08 22:22 
GeneralRe: How can I convert generic list? Pin
phannon8621-Apr-08 22:33
professionalphannon8621-Apr-08 22:33 
AnswerRe: How can I convert generic list? Pin
marekS08221-Apr-08 22:30
marekS08221-Apr-08 22:30 
GeneralWindows Service Account Pin
telha21-Apr-08 21:42
telha21-Apr-08 21:42 
Generalproblem with DateTimePicker Control. Pin
avvaru.murali21-Apr-08 20:29
avvaru.murali21-Apr-08 20:29 
AnswerRe: problem with DateTimePicker Control. Pin
Christian Wikander21-Apr-08 20:39
Christian Wikander21-Apr-08 20:39 

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.