ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • ShowMessageCenter
    C++ Builder/함수 2018. 12. 6. 22:32


    #ShowMessageCenter

    // 현재폼의 가운데에 시스템 메세지 띄우는 함수 코드

    void __fastcall ShowMessageCenter(String Msg)

    {

     static TCanvas *MsgCanvas=NULL;

     if(MsgCanvas==NULL)

     {

       MsgCanvas=new TCanvas;

       MsgCanvas->Font->Name="MS Sans Serif";

       MsgCanvas->Font->Size=9;

     }

     if(Screen->ActiveForm)

     {

       MsgCanvas->Handle=GetDC(Screen->ActiveForm->Handle);

       TSize ts=MsgCanvas->TextExtent(Msg);

       if(ts.cx<102)ts.cx=102;

       TForm *MsgForm=CreateMessageDialog(Msg, mtCustom, TMsgDlgButtons () << mbOK);

       MsgForm->Left=Screen->ActiveForm->Left + (Screen->ActiveForm->Width-ts.cx)/ 2 - 20 ;

       MsgForm->Top=Screen->ActiveForm->Top  + (Screen->ActiveForm->Height-92-ts.cy)/ 2;

       MsgForm->ShowModal();

     }

     else

     {

         ShowMessage(Msg);

     }

    }  



    728x90

    'C++ Builder > 함수' 카테고리의 다른 글

    ZeroMemory & CopyMemory  (0) 2018.12.07
    MessageDlg  (0) 2018.12.06
    foam  (0) 2018.12.06
    ToIntDef  (0) 2018.12.06
    ToInt  (0) 2018.12.06

    댓글

Designed by Tistory.