Re: How to draw on "Microsoft Web Browser" control?



Thank you for your reply.

I am doing semantic analysis on the HTML DOM tree, so I am not sure
whether it is a good idea for me to insert elements into the tree.
Draw on existing elements doesn't change the structure of the html
tree, but it changes the content, doesn't it? I don't really understand
what you mean by "drawing on existing elements". Change its style using
IHTMLStyle?

I will try using CHtmlView or CHtmlCtrl in your link first and see the
result.

Thanks again :)

Ajay Kalra wrote:
CWebBrowser2 is not the subclass you want. Take a look here about the
correct window to subclass:

http://msdn.microsoft.com/msdnmag/issues/01/09/c/default.aspx

Having said that, I am not sure if subclassing and drawing on it is the
correct way. I would go with inserting an element or draw on existing
element.

---
Ajay

ZhiguoYoung@xxxxxxxxx wrote:
I have a "Microsoft Web Browser" in my program.
VC generated CWebBrowser2 as a wrapper class of ActiveX control
"Microsoft Web Broswer", which is a subclass of CWnd.
Now I get the position and size of a certain html element, say, an
image, and I want to draw a red rectangle to encompass it.
I tried to do that by the following code but it doesn't work.


RECT rect = {100, 100, 100, 100};
CDC * pdc = this->m_webBrowser.GetDC();

CPen newPen;
newPen.CreatePen(PS_SOLID, 3, RGB(25, 255, 25));
pdc->SelectObject(&newPen);
pdc->Rectangle(&rect);

CBrush newBrush;
newBrush.CreateStockObject(HOLLOW_BRUSH);
pdc->FillRect(&rect, &newBrush);
ValidateRect(&rect);

this->m_webBrowser.ReleaseDC(pdc);

Does anyone know how I can do it?
Any help will be appreciated!

P.S.
I know I can make the image element maked by changing its style using
MSHTML, but there are situations that are far more complicated to
handle.

.



Relevant Pages

  • Re: Visitor and Observer combined?
    ... Whether the second tree is a delegation or a direct problem space ... subclass properties are accessed). ... element and vice versa or else they wouldn't be part of the pattern. ... it can be used to play and manipulate MIDI files. ...
    (comp.object)
  • Re: Multithreading in asp.net - pls reply
    ... Currenly I am using bitmap object to draw smaller ... the HTML--it'll be a lot of HTML to send to the user. ... I want it to be drawn faster...so I introduced multithreading ... LongTimeTask), "hi") ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [acyclic visitor]The "accept" operation of an object
    ... there are usually issues of behavior substitution basecon collaboration context. ... Visitor is somewhat unique in that it deals with a very special problem where the collaborating objects are from subclasses in different trees but they need to access the specializations of the subclass ... an object from any subclass in one tree may collaborate with an object of any subclass in the other tree. ... {if(visitor instanceof MyVisitor) ...
    (comp.object)
  • Re: Draw a rectangle
    ... this can't be done with HTML alone. ... JavaScript have the ability to draw, and once the page reaches the client, ... I have a toolbar which contains 'zoom in' ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Timeline
    ... Whilst Draw is great for setting out an existing tree - lining up, ... have a good RISC-OS genealogy program; not least it would have saved me ... LoadsaDosh in buying other computers with other operating systems to run ...
    (comp.sys.acorn.apps)