TheGreatCthulhu, thanks.
I tried your suggestion but it did not work. Let me know if I did something wrong.
I also tried drawing the rectangle with win API calls:Code:public void tempDrawRectUsingGraphicsObject(int x, int y, int width, int height) { Console.WriteLine("In tempDrawRectUsingGraphicsObject"); // get desktop window //IntPtr desktopHwnd = GetDesktopWindow(); // Create a new pen. Pen pen = new Pen(Brushes.Red); // Set the pen's width. pen.Width = 8.0F; // Set the LineJoin property. pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel; Graphics gr = Graphics.FromHwnd(IntPtr.Zero); //IntPtr.Zero Font font = new Font("Arial",10); System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); gr.DrawString("Test string", font, myBrush, new PointF(x, y)); gr.DrawRectangle(pen, x, y, width, height); }
I think it **is** possible to accomplish what I want, but I'm out of ideas.Code:public void tempDrawRectUsingWinAPI(int x, int y, int width, int height) { Console.WriteLine("In tempDrawRectUsingWinAPI"); IntPtr desktopHwnd = GetDesktopWindow(); Graphics gr = Graphics.FromHwnd(desktopHwnd); IntPtr hdc = gr.GetHdc(); uint uintColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(255, 0, 0))); IntPtr gdiPen = CreatePen(0, 5, uintColor); SelectObject(hdc, gdiPen); Rectangle(hdc, x, y, x + width, y + height); }
Anything you can think of is appeciated.
Thanks




Reply With Quote