<em id="kkln5"><ruby id="kkln5"><u id="kkln5"></u></ruby></em>
<rp id="kkln5"></rp>

    <s id="kkln5"><object id="kkln5"></object></s>
  1. <dd id="kkln5"><pre id="kkln5"></pre></dd>
  2. 首頁 > 編程 > Java > 正文

    制作透明窗體

    2019-09-06 23:33:16
    字體:
    來源:轉載
    供稿:網友

                        1.重載CreateParams函數,設置透明風格
    2.然后重載它的WM_ERASEBKGND消息。
    代碼片段:

    .h File
    class TYourForm:public TForm
    {
    private:
    /tvoid __fastcall WMNC(TMessage &Message);
    public:
    /t__fastcall TYourForm(TComponent *Owner);
    /tBEGIN_MESSAGE_MAP
    /t  VCL_MESSAGE_HANDLER(WM_ERASEBKGND,TMessage,WMNC);
    /tEND_MESSAGE_MAP(TForm);
    protected:
    /tvirtual void __fastcall CreateParams(TCreateParams &Params);
    }


    .cpp File

    void __fastcall TYourForm::CreateParams(TCreateParams &Params)
    {
     TForm::CreateParams(Params);
     Params.EX_STYLE|=WS_EX_TRANSPARENT;
    }
    void __fastcall TYourForm::WMNC(TMessage &Message)
    {
     SetBkMode(GetWindowDC(this->Handle),OPAQUE);
     ReleaseDC(this->Handle,GetWindowDC(this->Handle)) ;
     Messgae.Result=1;
    }
    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    <em id="kkln5"><ruby id="kkln5"><u id="kkln5"></u></ruby></em>
    <rp id="kkln5"></rp>

      <s id="kkln5"><object id="kkln5"></object></s>
    1. <dd id="kkln5"><pre id="kkln5"></pre></dd>