SayeyeZohor
جمعه 13 اردیبهشت 1392, 13:51 عصر
با سلام خدمت دوستان
من یک فانکشن برای مسیج باکس نوشتم که بتونیم تععین کنیم فونت مسیج باکس چی باشه
اما یک مشکل کوچولو:
این که
1 : wordwrap نداره
2- سایز فرمش کوچکتر از فرم MessageDLG میشه
NewMessageDlg
103630
MessageDlg
103631
اینم کدم:
FUNCTION MessageDlgPosSetFont(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint;
X, Y: Integer;
sFontName: string; iFontSize: Integer; FsStyle: TFontStyles): Integer;
BEGIN
with CreateMessageDialog(Msg, DlgType, Buttons) do
try
HelpContext := HelpCtx;
if X >= 0 then Left := X;
if Y >= 0 then Top := Y;
if (Y < 0) and (X < 0) then Position := poScreenCenter;
// set the font name, size and style
Font.Name:=sFontName;
Font.Size:=iFontSize;
Font.Style:=fsStyle;
Result := ShowModal;
finally
Free;
end;
END;
FUNCTION NewMessageDlg(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
BEGIN
MessageDlgPosSetFont(Msg, DlgType, Buttons, HelpCtx, -1, -1, 'Tahoma', 8, []);
END;
با خاصیت width میتونم فرمش رو بزرگتر کنم ولی MessageDlg پیش فرضش این شکلیه
من یک فانکشن برای مسیج باکس نوشتم که بتونیم تععین کنیم فونت مسیج باکس چی باشه
اما یک مشکل کوچولو:
این که
1 : wordwrap نداره
2- سایز فرمش کوچکتر از فرم MessageDLG میشه
NewMessageDlg
103630
MessageDlg
103631
اینم کدم:
FUNCTION MessageDlgPosSetFont(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint;
X, Y: Integer;
sFontName: string; iFontSize: Integer; FsStyle: TFontStyles): Integer;
BEGIN
with CreateMessageDialog(Msg, DlgType, Buttons) do
try
HelpContext := HelpCtx;
if X >= 0 then Left := X;
if Y >= 0 then Top := Y;
if (Y < 0) and (X < 0) then Position := poScreenCenter;
// set the font name, size and style
Font.Name:=sFontName;
Font.Size:=iFontSize;
Font.Style:=fsStyle;
Result := ShowModal;
finally
Free;
end;
END;
FUNCTION NewMessageDlg(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
BEGIN
MessageDlgPosSetFont(Msg, DlgType, Buttons, HelpCtx, -1, -1, 'Tahoma', 8, []);
END;
با خاصیت width میتونم فرمش رو بزرگتر کنم ولی MessageDlg پیش فرضش این شکلیه