[yunqa.de] Re: Suggestion - Make TDiHtmlLabel.FRect protected.

  • From: Edwin Yip <edwin.yip@xxxxxxxxxxxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sun, 19 Feb 2012 21:56:29 +0800

Hi Ralf,

Yes, when drawing the background to indicate the 'hot' status of the label,
I use ClientRect, but since in my overridden Paint() method I can't call
inherited, instead I have to copy and modify the method body of
TDiHtmlLabel which needs to access the FRect field in order to paint the
html tags.

Precisely, it's the following code:
Renderer.RenderTree(Canvas, FRect, FNodeTree);

On Sun, Feb 19, 2012 at 6:36 AM, Delphi Inspiration <delphi@xxxxxxxx> wrote:

> On 17.02.2012 07:21, Edwin Yip wrote:
>
> > Would you change the visibility of TDiHtmlLabel.FRect to protected from
> > private?
> >
> > I made a derived control based on TDiHtmlLabel added a function to
> > reflect the 'mouse hover' state of the control (by changing the label's
> > entire background color when the user mouse hover the control).
> >
> > In order to do that I had to overridden the Paint method which will need
> > to access the FRect field.
>
> My feeling is that FRect is not ideal for your purpose. FRect describes
> the part of the control where the HTML is painted. It is determined by
> the control's width and height minus MarginHeight and MarginWidth. I
> suppose you are looking for ClientRect instead.
>
> Further I suggest to publish the OnMouseEnter and OnMouseLeave
> properties added to TControl with Delphi 2007. This allows to change the
> background color by simply settings the TDIHtmlLabel.Color property in
> mouse events.
>
> Ralf
> _______________________________________________
> Delphi Inspiration mailing list
> yunqa@xxxxxxxxxxxxx
> //www.freelists.org/list/yunqa
>
>
>
>


-- 
Best Regards,
Edwin Yip

Mind Mapping is as Effortless as Typing
http://www.InnovationGear.com

Other related posts: