📄 newdocdlg.cpp
字号:
// NewDocDlg.cpp : implementation file
//
#include "stdafx.h"
#include "tt.h"
#include "NewDocDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNewDocDlg dialog
CNewDocDlg::CNewDocDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNewDocDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewDocDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bBt1 =false;
m_bBt2 = false;
m_bBt3 = false;
str1 = "1";
}
void CNewDocDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewDocDlg)
DDX_Control(pDX, IDC_BUTTON3, m_button3);
DDX_Control(pDX, IDC_OBJLIST, m_list2);
DDX_Control(pDX, IDC_STYLELIST, m_list1);
DDX_Control(pDX, IDC_BUTTON2, m_objselect);
DDX_Control(pDX, IDC_BUTTON1, m_styleselect);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewDocDlg, CDialog)
//{{AFX_MSG_MAP(CNewDocDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_LBN_SELCHANGE(IDC_STYLELIST, OnStylelistChange)
ON_LBN_DBLCLK(IDC_STYLELIST, OnDblclkStylelist)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewDocDlg message handlers
BOOL CNewDocDlg::OnInitDialog()
{
CDialog::OnInitDialog();
GetWindowRect(conDlg);
/* ::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA1),conSmall);
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA2),conBig);
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA3),conBiger);
*/ ShowDlg(Small);
return TRUE;
}
/*void CNewDocDlg::ShowAera()
{
CRect rc,rectArea;
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA1),rectArea);
HWND hChild = ::GetWindow(m_hWnd,GW_CHILD);
for(; hChild != NULL; hChild = ::GetWindow(hChild,GW_HWNDNEXT))
{
::GetWindowRect(hChild,&rc);
if(rc.left > rectArea.right) ::EnableWindow(hChild,m_bBt1);
}
int width;
width = conSmall.right -conSmall.left + 13;
SetWindowPos(NULL,0,0,width,conDlg.bottom - conDlg.top,SWP_NOZORDER | SWP_NOMOVE);
}
*/
void CNewDocDlg::OnButton1()
{
CRect rc,rectArea;
if(!m_bBt1) m_styleselect.SetWindowText("<<Button1");
else m_styleselect.SetWindowText("Button1>>");
m_bBt1 = !m_bBt1;
//当点激1按钮时,要注意恢复2、3按钮的状态
if(m_bBt2)
{
m_objselect.SetWindowText("Button2>>");
m_bBt2 = !m_bBt2;
}
if(m_bBt3)
{
m_button3.SetWindowText("Button3>>");
m_bBt3 = !m_bBt3;
}
ShowDlg(Big);
}
void CNewDocDlg::OnButton2()
{
if(!m_bBt2) m_objselect.SetWindowText("<<Button2");//////////////////
else m_objselect.SetWindowText("Button2>>");
m_bBt2 = !m_bBt2;
//当点激2按钮时,要注意恢复3按钮的状态
if(m_bBt3)
{
m_button3.SetWindowText("Button3>>");
m_bBt3 = !m_bBt3;
}
ShowDlg(Biger);
}
void CNewDocDlg::OnStylelistChange()
{
m_list1.GetText(m_list1.GetCurSel(),str1);
}
void CNewDocDlg::OnDblclkStylelist()
{
OnButton1();
}
void CNewDocDlg::ShowDlg(Dimesion i)
{
CRect rc,rectArea,conSmall,conBig,conBiger;
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA3),rectArea);
HWND hChild = ::GetWindow(m_hWnd,GW_CHILD);
for(; hChild != NULL; hChild = ::GetWindow(hChild,GW_HWNDNEXT))
{
::GetWindowRect(hChild,&rc);
if(rc.left > rectArea.right) ::EnableWindow(hChild,m_bBt1);
}
// GetWindowRect(conDlg);
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA1),conSmall);
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA2),conBig);
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_AREA3),conBiger);
int width;
switch (i){
case Small:
width = conSmall.right -conSmall.left + 13;
break;
case Big:
if(m_bBt1) width = conBig.right-conBig.left+13;
else width = conSmall.right -conSmall.left + 13;
break;
case Biger:
if(m_bBt2) width = conBiger.right-conBiger.left+13;
else width = conBig.right -conBig.left + 13;
break;
case Bigest:
if(m_bBt3) width = conDlg.right-conDlg.left;
else width = conBiger.right- conBiger.left + 13;
break;
}
SetWindowPos(NULL,0,0,width,conDlg.bottom - conDlg.top,SWP_NOZORDER | SWP_NOMOVE);
}
void CNewDocDlg::OnButton3()
{
if(!m_bBt3) m_button3.SetWindowText("<<Button3");
else m_button3.SetWindowText("Button3>>");
m_bBt3 = !m_bBt3;
ShowDlg(Bigest);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -