📄 showfirstright.cpp
字号:
// ShowFirstRight.cpp : implementation file
//
#include "stdafx.h"
#include "SuperViseSystem.h"
#include "ShowFirstRight.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShowFirstRight
CShowFirstRight::CShowFirstRight()
{
m_bIsSetImage = true;
//主左框架按钮坐标 0.监听
main_rectBT0.left = 33;
main_rectBT0.top = 448;
main_rectBT0.right = 108;
main_rectBT0.bottom = 482;
m_MainPicture[0].rect = main_rectBT0;
//---------------1.录象
main_rectBT1.left = 133;
main_rectBT1.top = 448;
main_rectBT1.right = 208;
main_rectBT1.bottom = 482;
m_MainPicture[1].rect = main_rectBT1;
//---------------2.侦测
main_rectBT2.left = 33;
main_rectBT2.top = 498;
main_rectBT2.right = 108;
main_rectBT2.bottom = 530;
m_MainPicture[2].rect = main_rectBT2;
//---------------3.布防
main_rectBT3.left = 133;
main_rectBT3.top = 498;
main_rectBT3.right = 208;
main_rectBT3.bottom = 530;
m_MainPicture[3].rect = main_rectBT3;
//---------------4.锁定
main_rectBT4.left = 33;
main_rectBT4.top = 546;
main_rectBT4.right = 108;
main_rectBT4.bottom = 580;
m_MainPicture[4].rect = main_rectBT4;
//---------------5.隐藏
main_rectBT5.left = 133;
main_rectBT5.top = 546;
main_rectBT5.right = 208;
main_rectBT5.bottom = 580;
m_MainPicture[5].rect = main_rectBT5;
}
CShowFirstRight::~CShowFirstRight()
{
}
BEGIN_MESSAGE_MAP(CShowFirstRight, CWnd)
//{{AFX_MSG_MAP(CShowFirstRight)
ON_WM_LBUTTONDOWN()
ON_WM_PAINT()
ON_MESSAGE(WM_MYMESSAGE,OnMyMessage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShowFirstRight message handlers
BOOL CShowFirstRight::Create(DWORD dwStyle, CRect& rect, CWnd* pParent, UINT id)
{
BOOL result ;
result = CWnd::CreateEx(NULL ,
NULL, NULL, dwStyle,
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
pParent->GetSafeHwnd(), (HMENU)id) ;
if( !result )
AfxMessageBox("Error creating window");
m_rcImgWnd.top = m_rcImgWnd.left = 0;
m_rcImgWnd.bottom = m_rcImgWnd.top + rect.Height();
m_rcImgWnd.right = m_rcImgWnd.left + rect.Width();
//m_MemDC为CDC类的一个对象.
m_MemDC.CreateCompatibleDC(GetDC());// 创建什么东西?
return result;
}
void CShowFirstRight::OnLButtonDown(UINT nFlags, CPoint point)
{
for(int i=0;i<6;i++)
{
rect_all = m_MainPicture[i].rect;
if (((rect_all.left < point.x) && (point.x< rect_all.right))
&& (rect_all.top < point.y) && (point.y < rect_all.bottom))
{
OnSelect(i);
}
}
CWnd::OnLButtonDown(nFlags, point);
}
void CShowFirstRight::OnPaint()
{
CPaintDC dc(this);
if(m_bIsSetImage)
{
m_MemDC.SelectObject(m_bpImageWnd);
dc.BitBlt(0,0,m_rcImgWnd.Width(),m_rcImgWnd.Height(),&m_MemDC,0,0,SRCCOPY);
}
}
void CShowFirstRight::SetImage(HBITMAP *hbp)
{
m_bpImageWnd.Attach(hbp);
m_bIsSetImage = true;
this->Invalidate();
}
void CShowFirstRight::OnMyMessage(int BT_IDC)
{
GetParent()->PostMessage(WM_MYMESSAGE,BT_IDC);
}
//--------------------
void CShowFirstRight::OnSelect(int num)
{
switch(num)
{
case 0:
AfxMessageBox("监听模块开发当中,请等待");
break;
case 1:
AfxMessageBox("录象模块开发当中,请等待");
break;
case 2:
AfxMessageBox("侦测模块开发当中,请等待");
break;
case 3:
AfxMessageBox("布防模块开发当中,请等待");
break;
case 4:
AfxMessageBox("所定模块开发当中,请等待");
break;
case 5:
AfxGetMainWnd()->PostMessage(WM_SYSCOMMAND,SC_MINIMIZE,0);
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -