L
Logan McKinley
I need to draw a dot where ever the user clicks (which will be on either
the form or a couple dynamically placed picture boxes). I thought the
following code should work:
//---
[DllImport("user32.dll", EntryPoint = "WindowFromPoint")]
static public extern IntPtr WindowFromPoint(System.Drawing.Point Point);
//...
h = (System.Drawing.Point)hits[iii]; // this is an array of Point
objects
ip = WindowFromPoint(h);
System.Diagnostics.Trace.WriteLine(ip.ToString());
g = Graphics.FromHwnd(ip.Handle);
g.FillEllipse(b,h.X,h.Y,20,20);
//---
but it seems to return sparatic results.
However the following code works consistantly
//---
//...
h = (System.Drawing.Point)hits[iii]; // this is an array of Point
objects
g = Graphics.FromHwnd(this.Handle); // <------------------- change
g.FillEllipse(b,h.X,h.Y,20,20);
//---
The problem with the second code is that the dots are apparently drawn under
the picture box and cannot be seen. I need the dot to be top most so the
user can see it.
Thanks in advance,
~Logan
the form or a couple dynamically placed picture boxes). I thought the
following code should work:
//---
[DllImport("user32.dll", EntryPoint = "WindowFromPoint")]
static public extern IntPtr WindowFromPoint(System.Drawing.Point Point);
//...
h = (System.Drawing.Point)hits[iii]; // this is an array of Point
objects
ip = WindowFromPoint(h);
System.Diagnostics.Trace.WriteLine(ip.ToString());
g = Graphics.FromHwnd(ip.Handle);
g.FillEllipse(b,h.X,h.Y,20,20);
//---
but it seems to return sparatic results.
However the following code works consistantly
//---
//...
h = (System.Drawing.Point)hits[iii]; // this is an array of Point
objects
g = Graphics.FromHwnd(this.Handle); // <------------------- change
g.FillEllipse(b,h.X,h.Y,20,20);
//---
The problem with the second code is that the dots are apparently drawn under
the picture box and cannot be seen. I need the dot to be top most so the
user can see it.
Thanks in advance,
~Logan