📄 consoledisplay1.cpp
字号:
// ConsoleDisplay1.cpp : implementation file
//
#include "stdafx.h"
#include "ConsoleDisplay.h"
#include "ConsoleDisplay1.h"
#include "ConsoleDisplayDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HANDLE hcondisplay;
/////////////////////////////////////////////////////////////////////////////
// CConsoleDisplay dialog
extern bool tmodmo;
CConsoleDisplay::CConsoleDisplay(CWnd* pParent /*=NULL*/)
: CDialog(CConsoleDisplay::IDD, pParent)
{
//{{AFX_DATA_INIT(CConsoleDisplay)
if(tmodmo==false)
m_consolemode = _T("Connecting...");
else
m_consolemode = _T("Direct");
//}}AFX_DATA_INIT
}
void CConsoleDisplay::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConsoleDisplay)
DDX_Control(pDX, IDC_TAB1, m_tablectrl);
DDX_Text(pDX, IDC_EDIT1, m_consolemode);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConsoleDisplay, CDialog)
//{{AFX_MSG_MAP(CConsoleDisplay)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConsoleDisplay message handlers
BOOL CConsoleDisplay::OnInitDialog()
{
CDialog::OnInitDialog();
CRect r;
m_tablectrl.GetClientRect(&r);
hcondisplay=GetSafeHwnd();
// TODO: Add extra initialization here
imageList.Create(32,32,ILC_COLOR16,0,0);
imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON4));
m_tablectrl.SetImageList(&imageList);
TCITEM item;
item.mask=TCIF_IMAGE;
item.iImage=0;
m_tablectrl.InsertItem(0,&item);
item.iImage=1;
m_tablectrl.InsertItem(1,&item);
item.iImage=2;
m_tablectrl.InsertItem(2,&item);
item.iImage=3;
m_tablectrl.InsertItem(3,&item);
m_inbox.Create(IDD_CONSOLE_INBOX,&m_tablectrl);
m_setting.Create(IDD_CONSOLE_SETTING,&m_tablectrl);
m_phonebook.Create(IDD_CONSOLE_PHONE,&m_tablectrl);
m_send.Create(IDD_CONSOLE_SEND,&m_tablectrl);
m_inbox.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_SHOWWINDOW);
m_setting.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_phonebook.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_send.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CConsoleDisplay::OnButton1()
{
// TODO: Add your control notification handler code here
CDialog::OnOK();
CConsoleDisplayDlg a;
a.DoModal();
}
void CConsoleDisplay::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CRect r;
m_tablectrl.GetClientRect(&r);
switch(m_tablectrl.GetCurSel())
{
case 0:
m_inbox.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_SHOWWINDOW);
m_setting.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_phonebook.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_send.SetWindowPos(NULL,20,40,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
break;
case 1:
m_inbox.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_setting.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_SHOWWINDOW);
m_phonebook.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_send.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
break;
case 2:
m_inbox.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_setting.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_phonebook.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_SHOWWINDOW);
m_send.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
break;
case 3:
m_inbox.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_setting.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_phonebook.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_HIDEWINDOW);
m_send.SetWindowPos(NULL,10,30,r.right-20,r.bottom-40,SWP_SHOWWINDOW);
break;
}
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -