paint 問題 |
尚未結案
|
GiGi
一般會員 發表:17 回覆:21 積分:7 註冊:2002-10-19 發送簡訊給我 |
|
pedro
尊榮會員 發表:152 回覆:1187 積分:892 註冊:2002-06-12 發送簡訊給我 |
|
GiGi
一般會員 發表:17 回覆:21 積分:7 註冊:2002-10-19 發送簡訊給我 |
pedro 謝謝您的回應 我把 PAINT POST 出來 請站上各位先進 幫忙 procedure TNewBzLabel.Paint;
const
Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
var
Rect: TRect;
begin
with Canvas do
begin
if not Transparent then
begin
Brush.Color := Self.Color;
Brush.Style := bsSolid;
FillRect(ClientRect);
end;
Brush.Style := bsClear;
Rect := ClientRect;
DoDrawText( Rect, ( DT_EXPANDTABS or DT_WORDBREAK ) or
Alignments[ Alignment ] );
end;
end;
procedure TNewBzLabel.DoDrawText( var Rect : TRect; Flags : Word );
var
{Text : array[ 0..255 ] of Char; }
Text : PChar;
Size: Byte;
TmpRect : TRect;
UpperColor : TColor;
LowerColor : TColor;
begin
Size := GetTextLen; {Get length of string in Edit1}
Inc(Size); {Add room for null character}
GetMem(Text, Size);
GetTextBuf(Text, Size); {Creates Buffer dynamic variable}
{GetTextBuf(Text, SizeOf(Text)); } Canvas.Font.Color := FFont.Color; //SiteNum
Canvas.Font := FFont;
DrawText(Canvas.Handle, PChar(' ' SiteNum), StrLen(PChar(SiteNum ' ')), Rect, Word(DT_RIGHT));
Rect.Top:=Rect.Top ((Height) div 4);
if ( Flags and DT_CALCRECT <> 0) and
( ( Text[0] = #0 ) or ShowAccelChar and
( Text[0] = '&' ) and
( Text[1] = #0 ) ) then
StrCopy(Text, ' '); if not ShowAccelChar then
Flags := Flags or DT_NOPREFIX;
Canvas.Font := Font; if F3DEffect = Resit3d then
begin
UpperColor := FShadowColor;
LowerColor := FWhiteColor;
end
else
begin
UpperColor := FWhiteColor;
LowerColor := FShadowColor;
end; if F3DEffect in [ Resit3d, Raised3d ] then
begin
TmpRect := Rect;
OffsetRect( TmpRect, 1, 1 );
Canvas.Font.Color := LowerColor;
TmpRect := Rect;
OffsetRect( TmpRect, -1, -1 );
Canvas.Font.Color := UpperColor;
DrawText(Canvas.Handle, Text, StrLen(Text), TmpRect, Flags);
end
else if F3DEffect = Shadowed3d then
begin TmpRect := Rect;
OffsetRect( TmpRect, FhOffSet, FvOffSet );
Canvas.Font.Color := LowerColor;
DrawText(Canvas.Handle, Text, StrLen(Text), TmpRect, Flags);
end; Canvas.Font.Color := Font.Color;
if not Enabled then
Canvas.Font.Color := clGrayText;
DrawText(Canvas.Handle, Text, StrLen(Text), Rect, Flags);
FreeMem(Text, Size);
end; 抱歉 有一點長 謝謝耐心看完
|
GiGi
一般會員 發表:17 回覆:21 積分:7 註冊:2002-10-19 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |