471,354 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

How to draw a rectangle on AxWebBrowser to high light one html element?

Hi,

Now I can get the rectangle to draw, but it seems the rectangle is not
visible. The following code is used to draw the rectangle. Hope someone can
help. Thanks very much!

SolidBrush brush = new
System.Drawing.SolidBrush(System.Drawing.Color.Red );
Pen pen = new Pen(brush, 4);
Graphics formGraphics = Graphics.FromHwnd(this.axWebBrowser.Handle);
formGraphics.DrawRectangle(pen, rect);
Jan 23 '06 #1
2 3574
Andy,

Why don't you change the markup so that the rectangle is drawn by the
control itself, instead of drawing on the control itself?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Andy Chen" <pp****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

Now I can get the rectangle to draw, but it seems the rectangle is not
visible. The following code is used to draw the rectangle. Hope someone
can help. Thanks very much!

SolidBrush brush = new
System.Drawing.SolidBrush(System.Drawing.Color.Red );
Pen pen = new Pen(brush, 4);
Graphics formGraphics = Graphics.FromHwnd(this.axWebBrowser.Handle);
formGraphics.DrawRectangle(pen, rect);

Jan 23 '06 #2
Yes, actually I tried by overriding the Wndproc method and handle WM_PAINT
message. Unfortunately I failed. Is there any interfaces provided by
webbrowser control can be used to do this job?

Thanks!
Andy

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ed**************@TK2MSFTNGP10.phx.gbl...
Andy,

Why don't you change the markup so that the rectangle is drawn by the
control itself, instead of drawing on the control itself?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Andy Chen" <pp****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

Now I can get the rectangle to draw, but it seems the rectangle is not
visible. The following code is used to draw the rectangle. Hope someone
can help. Thanks very much!

SolidBrush brush = new
System.Drawing.SolidBrush(System.Drawing.Color.Red );
Pen pen = new Pen(brush, 4);
Graphics formGraphics = Graphics.FromHwnd(this.axWebBrowser.Handle);
formGraphics.DrawRectangle(pen, rect);


Jan 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Praveen | last post: by
1 post views Thread by Rob Richardson | last post: by
3 posts views Thread by Tom | last post: by
6 posts views Thread by Brad Shook | last post: by
7 posts views Thread by Mark Ingram | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.