Recent

Author Topic: TLabel with border.  (Read 26424 times)

dicas3d

  • Jr. Member
  • **
  • Posts: 81
    • Site oficial do Lazarus Portugal
Re: TLabel with border.
« Reply #15 on: June 07, 2011, 07:11:37 pm »
Code: [Select]
Label1.Canvas.Rectangle(0,0,Label1.Width, Label1.Height);
No rectangle.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: TLabel with border.
« Reply #16 on: June 07, 2011, 07:30:21 pm »
Each component has its own canvas that starts from 0, 0. If you have a TPaintBox for example you draw to it starting from 0, 0. If you move its Left and Right elsewhere the graphics move along with it.

However, if i start new project and create new label with default properties on form, and put this in FormPaint event
Code: [Select]
 with Label1 do begin
    canvas.Pen.Color:=clBlack;
    canvas.Pen.Width:=1;
    canvas.Brush.Style:=bsClear;
    Canvas.Rectangle(0, 0, Width, Height);
  end;    
I do not see a rectangle. I tried with setting its Transparent property false and Color property to clBtnFace, but still not seeing it.

Lazarus 0.9.31 SVN 29541, fpc 2.4.3. Windows 7 32-bit.

edit:
if i add Label1.Repaint; after Rectangle it shows, and is flashing. But it seems like endless loop that hangs up application. I had to stop the app from Lazarus as it refused to close.
« Last Edit: June 07, 2011, 07:38:36 pm by User137 »

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: TLabel with border.
« Reply #17 on: June 07, 2011, 08:11:34 pm »
Maybe I'm late here, and I haven't read all post but, you can use TStaticText. Or you have problems with it?

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: TLabel with border.
« Reply #18 on: June 07, 2011, 08:50:42 pm »
If you create your own label component you can do whatever you need/want.
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: TLabel with border.
« Reply #19 on: June 07, 2011, 09:24:38 pm »
I reported bug:
http://bugs.freepascal.org/view.php?id=19516
because it seems that Windows and Linux+Qt has different behaviour.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: TLabel with border.
« Reply #20 on: June 07, 2011, 09:49:34 pm »
What is Qt? I'm just using the default components and packages unless its same thing.

dicas3d

  • Jr. Member
  • **
  • Posts: 81
    • Site oficial do Lazarus Portugal
Re: TLabel with border.
« Reply #21 on: June 08, 2011, 01:50:22 pm »
You need put the line Repaint on the place that you need that the rectangle appear. Example:onClick
« Last Edit: June 08, 2011, 01:59:26 pm by dicas3d »

dicas3d

  • Jr. Member
  • **
  • Posts: 81
    • Site oficial do Lazarus Portugal
Re: TLabel with border.
« Reply #22 on: June 08, 2011, 02:07:58 pm »
I no work well.

dicas3d

  • Jr. Member
  • **
  • Posts: 81
    • Site oficial do Lazarus Portugal
Re: TLabel with border.
« Reply #23 on: June 09, 2011, 12:41:19 pm »
I solve the problem and put the solution on My blog at http://pprograming.blogspot.com/2011/06/text-with-borders-no-problem.html .

 

TinyPortal © 2005-2018