Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.05.02;
Скачать: CL | DM;

Вниз

Label с многоточием   Найти похожие ветки 

 
Andre____   (2004-04-16 13:59) [0]

Здравствуйте, Мастера! Подскажите компанент наподобие TLabel, но функционирующий как в Opera, т.е если надпись не умещается, в конце ставится "...". Заранее благодарен.


 
ZrenBy ©   (2004-04-16 14:35) [1]

DT_END_ELLIPSIS


 
Andre____   (2004-04-16 16:03) [2]

2 ZrenBy ©   (16.04.04 14:35) [1]

Спасибо.

P.S: Привожу код - пожет кому понадобится.


unit myLabel;

interface

uses
 SysUtils, Classes, Controls, StdCtrls, Windows, Graphics;

type
 TmyLabel = class(TLabel)
 private
   { Private declarations }
 protected
   { Protected declarations }
   procedure DoDrawText(var Rect: TRect; Flags: Longint); override;
 public
   { Public declarations }
 published
   { Published declarations }
 end;

procedure Register;

implementation

procedure Register;
begin
 RegisterComponents("my", [TmyLabel]);
end;

procedure TmyLabel.DoDrawText(var Rect: TRect; Flags: Longint);
var
 Text: string;
begin
 Text := GetLabelText;
 if (Flags and DT_CALCRECT <> 0) and ((Text = "") or ShowAccelChar and
   (Text[1] = "&") and (Text[2] = #0)) then Text := Text + " ";
 if not ShowAccelChar then Flags := Flags or DT_NOPREFIX;
 Flags := DrawTextBiDiModeFlags(Flags+DT_END_ELLIPSIS);
 Canvas.Font := Font;
 if not Enabled then
 begin
   OffsetRect(Rect, 1, 1);
   Canvas.Font.Color := clBtnHighlight;
   DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
   OffsetRect(Rect, -1, -1);
   Canvas.Font.Color := clBtnShadow;
   DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
 end
 else
   DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
end;

end.



Страницы: 1 вся ветка

Текущий архив: 2004.05.02;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.023 c
1-1082266470
mur
2004-04-18 09:34
2004.05.02
TToolBar


1-1081761086
Ш-К
2004-04-12 13:11
2004.05.02
String


14-1081854360
Alex_x
2004-04-13 15:06
2004.05.02
может кто знает полный алгоритм такой защиты????


9-1068995883
m2003
2003-11-16 18:18
2004.05.02
Flip (0, DDFLIP_WAIT) возвращает DDERR_SURFACEBUSY


1-1082012479
Secety
2004-04-15 11:01
2004.05.02
От Dfm к рабочей форме.