CWnd::IsIconic解释

CWnd::IsIconic

BOOL IsIconic( ) const;

返回值:如果CWnd被最小化,则返回非零值;否则返回0。

说明:这个函数指明CWnd是否被最小化(图标化)。

请参阅:::IsIconic

转载于:https://www.cnblogs.com/fangmei/archive/2011/07/22/2114172.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 MFC 项目中建立一个名为 ClockDlg 的对话框类,可以按照以下步骤操作: 1. 打开 MFC 项目,在 Solution Explorer 中右键单击项目名称,选择 Add -> Class。 2. 在 Add Class 对话框中,选择 MFC Class,然后输入 Class Name 为 ClockDlg。 3. 在基类中选择 CDialog,然后单击 Add。 4. 在 ClassWizard 中添加 ClockDlg 的消息处理程序。 5. 在 ClockDlg.h 文件中添加以下代码: ``` #pragma once #include "afxwin.h" class CClockDlg : public CDialog { // Construction public: CClockDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_CLOCK_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() }; ``` 6. 在 ClockDlg.cpp 文件中添加以下代码: ``` #include "stdafx.h" #include "ClockDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CClockDlg dialog CClockDlg::CClockDlg(CWnd* pParent /*=NULL*/) : CDialog(CClockDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CClockDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CClockDlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() END_MESSAGE_MAP() // CClockDlg message handlers BOOL CClockDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control } void CClockDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } HCURSOR CClockDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } ``` 现在,您已经成功创建了一个名为 ClockDlg 的对话框类。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值