View Issue Details

IDProjectCategoryView StatusLast Update
0001727JEDI VCL00 JVCL Componentspublic2004-08-03 07:45
ReporterDierkAssigned Toobones 
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001727: TJVLabel: Some layout related issues
DescriptionI´ve added an additional X-offset for image and text when TJVLabel is framed. It´s an offset of 3 pixel. Otherwise the image draws over the frame. This change is in the attached JVLabel.
But there is an additional issue. I have in moment no time to fix it...:
When layout is tlBottom/tlTop and an image is assigned the image is further drawn in vertical center. I know tlxxxxx means textlayout but it wouldn´t look nice if text is on top and image in middle.

TagsNo tags attached.


2004-05-05 08:29


JvLabel.pas (39,083 bytes)


2004-05-05 19:39

reporter   ~0004160

Last edited: 2004-05-05 19:56

I propose to remove FrameRounded from code and replace paint procedure by this one, so rouded frame is no more polygonal and transparent property works again.

procedure TJvCustomLabel.Paint;
  Rect: TRect;
  DrawStyle: Integer;
  InteriorMargin: integer;
  InteriorMargin := 0;
  if not Enabled and not (csDesigning in ComponentState) then
    FDragging := False;
  with Canvas do
    if not Transparent then
      Canvas.Brush.Color := Color;
      Canvas.Brush.Style := bsSolid;
      DrawThemedBackground(Self, Canvas, ClientRect);
      Canvas.Brush.Style := bsClear;
    if FrameColor <> clNone then
      InteriorMargin := RoundedFrame div 5;
      Pen.Color := FrameColor;
      RoundRect(0, 0, Width, Height, RoundedFrame, RoundedFrame);
    Rect := ClientRect;
    Inc(Rect.Left, FLeftMargin + InteriorMargin);
    Dec(Rect.Right, FRightMargin + InteriorMargin);
    Inc(Rect.Top, InteriorMargin div 2);
    Dec(Rect.bottom, InteriorMargin div 2);
    InflateRect(Rect, -1, 0);
    DrawStyle := DT_EXPANDTABS or WordWraps[FWordWrap] or
    { Calculate vertical layout }
    if FLayout <> tlTop then
      DoDrawText(Rect, DrawStyle or DT_CALCRECT);
      Rect.Left := ClientRect.Left + FLeftMargin;
      Rect.Right := ClientRect.Right - FRightMargin;
      if FLayout = tlBottom then
        OffsetRect(Rect, 0, Height - Rect.Bottom)
        OffsetRect(Rect, 0, (Height - Rect.Bottom) div 2);
    DoDrawText(Rect, DrawStyle);
    if FShowFocus and Assigned(FFocusControl) and FFocused and
      not (csDesigning in ComponentState) then
      InflateRect(Rect, 1, 0);
      Brush.Color := Self.Color;
    if Angle = 0 then

modifié le : 05-05-04 19:49

modifié le : 05-05-04 19:55

modifié le : 05-05-04 19:56


2004-05-06 02:30

reporter   ~0004164

I think taking "RoundRect" instead of own procedure "FrameRounded" makes sense.
But not all frames should have a rounded corner. Only if property RoundedFrame is >0 then a roundedframe should be drawn.
If a RoundedFrame should be drawn then the background must not be filled with DrawThemedBackground, cause it fills the back as a rectangle.




2004-05-06 03:47


Switching to RoundRect is indeed the way to go but there is a problem with the RoundedFrame, XFrameOffset code: AutoSize doesn't work reliably anymore. Could you take a look at that?


2004-05-06 06:40

reporter   ~0004168

I´ll take a deep look at it. There are some other issues with layout, shadowedtext etc. Stay tuned....



2004-05-06 10:55

reporter   ~0004170

sorry but this is now a really confusing code. It´s to much timeintensive for me in moment to adjust all the wheels for the label´s layout.
I´ve tried it, but I must stop looking into it for now...

Hope anyone else can look to it.


2004-05-06 11:00


It probably needs a complete rewrite since it is a merging of several different labels and new features just stuck on top of it.

I'll see if I can do something about it, but it will be a while before I have time.


2004-05-06 23:58


I'm updating CVS with the changes we have so far but will put a note in theunit that AutoSize doesn't work reliably when using the framing feature.


2004-08-03 07:45

administrator   ~0004907

This bug has not had any activity for more than a month, it is therefore considered fixed.
To the original poster: If you think the issue is still there, even after having tested with the JVCL3, please create a new bug report.

To get the latest JCL and JVCL please go to these sites:

Issue History

Date Modified Username Field Change
2004-05-05 08:29 Dierk New Issue
2004-05-05 08:29 Dierk File Added: JvLabel.pas
2004-05-05 19:39 nestor Note Added: 0004160
2004-05-05 19:49 nestor Note Edited: 0004160
2004-05-05 19:55 nestor Note Edited: 0004160
2004-05-05 19:56 nestor Note Edited: 0004160
2004-05-06 02:30 Dierk Note Added: 0004164
2004-05-06 03:47 user72 Note Added: 0004165
2004-05-06 06:40 Dierk Note Added: 0004168
2004-05-06 10:55 Dierk Note Added: 0004170
2004-05-06 11:00 user72 Note Added: 0004172
2004-05-06 23:58 user72 Note Added: 0004176
2004-05-06 23:58 user72 Status new => acknowledged
2004-08-03 07:45 obones Status acknowledged => resolved
2004-08-03 07:45 obones Resolution open => fixed
2004-08-03 07:45 obones Assigned To => obones
2004-08-03 07:45 obones Note Added: 0004907