On Tue, 07 Aug 2007 14:12:19 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

> I'm developing a TCustomLabel descendant that will have a glyph
> painted in the left side of the text.
> 
> I found that there's no way to set the position where the text is 
> painted so i could have space to the glyph.
> 
> Currently i took the following approach (adding some spaces to the
> Caption):
> 
> function TGlyphLabel.GetLabelText: string;
> begin
>   Result := '    ' + Caption;
> end;
> 
> procedure TGlyphLabel.Paint;
> begin
>   inherited Paint;
>   with Canvas do
>   begin
>     Brush.Style := bsSolid;
>     Brush.Color := clWhite;
>     Pen.Color := clBlack;
>     Polygon([Point(0, 5), Point(8, 5), Point(4, 9)]);
>   end;
> end;
> 
> As a change to a properly implementation i would propose to add a 
> virtual method (DoMeasureTextPosition) to retrieve the TextLeft and 
> TextTop values (see TCustomLabel.Paint). The default implementation
> is equal to the current code in .Paint (I simplified a bit assuming
> that R.Top and R.Left = 0, R.Bottom = Height)
> 
> The patch is attached.

Thanks. Applied.

Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to