메세지 다이어그램(Message Dialog) 에 체크박스(CheckBox) 추가

메세지 다이어그램(Message Dialog) 에 체크박스(CheckBox) 를 추가한 예제입니다.

CreateMesageDialog, CheckBox 를 사용합니다.

uses Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

function UpdateDialog: Boolean;
var
 Dialog: TForm;
 ChkBox: TCheckBox;
begin
 Dialog := CreateMessageDialog('업데이트가 정보가 있습니다.'+#13#13+'안정적으로 사용하기 위해 업데이트를 하시길 권장합니다.'+#13#13+'다운로드 받으시겠습니까?', mtWarning, [mbYes, mbNo]);
 ChkBox := TCheckBox.Create(Dialog);

 with Dialog do
 begin
   Caption := '업데이트';
   FormStyle := fsStayOnTop;
   Position := poScreenCenter;
   Scaled := True;
   Height := Height + ScaleValue(50);

   with ChkBox do
   begin
     Parent := Dialog;
     Caption := '일주일 보지 않기';
     Width := Dialog.Width;
     Top := Dialog.Height - ScaleValue(70);
     Left := ScaleValue(10);
   end;

   for I := 0 to Dialog.ComponentCount - 1 do
   if Dialog.Components[i] is TButton then
     case TButton(Dialog.Components[i]).ModalResult of
       mrYes: TButton(Dialog.Components[i]).Caption := '확인';
       mrNo:  TButton(Dialog.Components[i]).Caption := '취소';
     end;

   if ChkBox.Checked then
   begin
     // 일주일 보지 않도록 하는 기능 추가
   end;

   Result := ShowModal = ID_YES;
 end;
end;

コメント

お役立ち掲示板

Delphi Delphi IDE 메인 폼 안열림 dproj 설정으로 해결
Delphi TDirectory.Delete 대신 CMD 으로 폴더 삭제
Delphi 폼이 모니터 한 가운데 있는 경우 자연스럽게 왼쪽으로 …
Delphi TrayIcon 이 흐릿하게 보이는 버그? 수정
Delphi 실행 중인 프로세스가 활성 창인지 확인하는 함수
閲覧 Delphi 메세지 다이어그램(Message Dialog) 에 체크박스(CheckB…
Delphi 윈도우 알림센터에 메시지 출력하기
Delphi 중복 실행 방지
Delphi 파일 포맷 알아내기
Delphi 권한상승
Delphi Glyph 에 사용할 이미지 생성하기
Delphi bsNone 인 폼에서 드래그 및 크기조절