J
John Bailo
I am walking through some of the very first sample code from the book
"Beginning .NET Game Programming" from Apress. I identify his sample
code with //SC
This code puzzles me:
Graphics graph = new Graphics //SC
// first of all there is no constructor for Graphics
// so in the Form_Paint I use instead:
private void Form1_Paint(object sender, PaintEventArgs pe)
{
Graphics graph = pe.Graphics;
//Then he wants to do:
graph = Graphics.FromHwnd(picSource.Image.); // SC
graph.FillRectangle( // SC
new SolidBrush(Color.Red), // SC
30, 20, 13, 7); // SC
This doesn't work at all because .FromHwnd is expecting an IntPtr
Can some one possibly see what the author is trying to do in this code?
Why would he want to acquire a handle from a pictureBox?
He can get it from:
IntPtr hdc = pe.Graphics.GetHdc();
"Beginning .NET Game Programming" from Apress. I identify his sample
code with //SC
This code puzzles me:
Graphics graph = new Graphics //SC
// first of all there is no constructor for Graphics
// so in the Form_Paint I use instead:
private void Form1_Paint(object sender, PaintEventArgs pe)
{
Graphics graph = pe.Graphics;
//Then he wants to do:
graph = Graphics.FromHwnd(picSource.Image.); // SC
graph.FillRectangle( // SC
new SolidBrush(Color.Red), // SC
30, 20, 13, 7); // SC
This doesn't work at all because .FromHwnd is expecting an IntPtr
Can some one possibly see what the author is trying to do in this code?
Why would he want to acquire a handle from a pictureBox?
He can get it from:
IntPtr hdc = pe.Graphics.GetHdc();