可擴充套件的對話方塊

2021-04-02 01:32:43 字數 2104 閱讀 8803

//可擴充套件和收縮的對話方塊

// 知識點1:

//// 得到第乙個子控制項

// cwnd *pwndctrl = this->getwindow( gw_child );

// 得到下乙個子控制項

// pwndctrl = pwndctrl->getwindow( gw_hwndnext );

// 知識點2:

//// rcrest等於rcshow與rccontrol重疊的區域

// 兩個矩形區求交,返回值型別為 bool

// rcrest.intersectrect( rcshow , rccontrol )

// 程式設計師: 黃江斌 http://blog.csdn.net/zerodspace

// expanddlg.cpp : 實現檔案

//#include "stdafx.h"

#include "expand.h"

#include "expanddlg.h"

#include "./expanddlg.h"

#ifdef _debug

#define new debug_new

#endif

// 用於應用程式「關於」選單項的 caboutdlg 對話方塊

class caboutdlg : public cdialog

;protected:

virtual void dodataexchange(cdataexchange* pdx);    // ddx/ddv 支援

// 實現

protected:

declare_message_map()

};caboutdlg::caboutdlg() : cdialog(caboutdlg::idd)

void caboutdlg::dodataexchange(cdataexchange* pdx)

begin_message_map(caboutdlg, cdialog)

end_message_map()

// cexpanddlg 對話方塊

void cexpanddlg::dodataexchange(cdataexchange* pdx)

begin_message_map(cexpanddlg, cdialog)

on_wm_syscommand()

on_wm_paint()

on_wm_querydragicon()

//}}afx_msg_map

on_bn_clicked(idc_expand, onbnclickedexpand)

end_message_map()

// cexpanddlg 訊息處理程式

bool cexpanddlg::oninitdialog()

void cexpanddlg::onsyscommand(uint nid, lparam lparam)

else

}// 如果向對話方塊新增最小化按鈕,則需要下面的**

//  來繪製該圖示。對於使用文件/檢視模型的 mfc 應用程式,

//  這將由框架自動完成。

void cexpanddlg::onpaint()

else

}//當使用者拖動最小化視窗時系統呼叫此函式取得游標顯示。

hcursor cexpanddlg::onquerydragicon()

void cexpanddlg::onbnclickedexpand()

// 擴充套件及取消窗體布局

void cexpanddlg::expanddlg(int nresourceid, bool &bexpand)

cstring cscaption;

if( bexpand )

else

//設定按鈕文字

this->setdlgitemtext( idc_expand , cscaption );

this->enablevisiblechildren();

bexpand = !bexpand;

}void cexpanddlg::enablevisiblechildren(void)

}參考資料:

《c++高階介面特效製作百例》中國電力出版社

Qt 可擴充套件對話方塊的實現

這裡是乙個簡單的可擴充套件對話方塊的小例子 視窗可擴充套件,但是各部件的位置沒有變化.上面布局的示意圖如下 只不過設定控制項在布局中的位置.下面是一些成員變數的定義.ifndef c h define c h include include ui c.h include include includ...

MFC擴充套件對話方塊 即收縮對話方塊

mfc擴充套件對話方塊 即收縮對話方塊 效果圖如下,擴充套件前 上 擴充套件後 下 上下擴充套件 具體步驟如下 1.在.h檔案中新增如下 1private 2boolm shrink 標記是否收縮 3intm winheight 儲存對話方塊的高度 4intm shrinkheight 收縮後的對話...

對話方塊收縮與擴充套件

void ctestdlg onbnclickedbutton2 else crect rectlarge crect rectsmall if rectlarge.isrectnull if str 收縮 else 在按鈕的方法下,定義變數cstring str 使用getdlgitemtext ...