1페이지
2페이지
3페이지
4페이지
5페이지
6페이지
7페이지
8페이지
9페이지
메뉴
현재 페이지 위치 : Home > 커뮤니티 > 질문과 답변

보기

Showmessage의 글자 크기 변경 방법 질문에 대한 답변입니다~

작성일2016-07-19 오후 9:17:47
  • no : 45
  • 작성자 : SYCODE
  • 조회 : 3469
showmessage함수 자체에서는 방법이 없습니다...
다른 방법이 있을지 모르겠으나 제가 찾은 방법으로는 새로운 다이얼로그를 만드는 방법입니다.
코드를 참조하셔서 테스트해보시기 바랍니다.
(버튼을 넣는 기능도 추가해두었습니다. 더 다양하게 사용해보시기 바랍니다.)



procedure TForm17.MyShowmessage(const sText: String; sFontName: String;
iFontSize: Integer);
var
oForm : TForm;
begin
oForm := TForm.Create(Application);
oForm.BorderStyle := bsDialog;
oForm.Position := poScreenCenter;
oForm.BiDiMode := Application.MainForm.BiDiMode;
oForm.Font.Name := sFontName;
oForm.Font.Size := iFontSize;
oForm.Height := 200;
oForm.Width := 300;
oForm.Caption := Application.Title;

with TMemo.Create(oForm) do
begin
Parent := oForm;
Align := alTop;
Lines.Clear;
Lines.Add('');
Lines.Add(sText);
Alignment := taCenter;
ParentFont := True;
Color := oForm.Color;
BorderStyle := bsNone;
Top := 10;
Left := 100;
Width := oForm.Width-130;
Readonly := True;
end;

with TButton.Create(oForm) do begin
Parent := oForm;
Top := oForm.Height - (Height * 3) + 10;
Left := (oForm.Width - Width) div 2;
Caption := 'OK';
ModalResult := mrOk;
Taborder := 0;
end;

oForm.ShowModal;
oForm.Free;
end;


procedure 사용 방법 : MyShowmessage( 출력글자, 글자체, 크기)
//Standard dialog.
//MyShowmessage('Hello world.');

//Now Change the forn name.
//MyShowmessage('Hello world.','Times New Roman');

//Change font name & size
//MyShowmessage('Hello world.','Times New Roman', 14);