⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 picsmall.cpp

📁 实时监控
💻 CPP
字号:
// PicSmall.cpp : implementation file
//
#include "tip_dlg.h"
#include "stdafx.h"
#include "../resource.h"
#include "../toolbars/RightLogin.h"
#include "PicSmall.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPicSmall dialog


CPicSmall::CPicSmall(CWnd* pParent /*=NULL*/)
	: CDialog(CPicSmall::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPicSmall)
	bNew    = FALSE ;
	bRecord = FALSE ;
	bSensor = FALSE ;
	bMotion = FALSE ;
	bVlost  = FALSE ;
	bMove   = FALSE ;
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CPicSmall::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPicSmall)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPicSmall, CDialog)
	//{{AFX_MSG_MAP(CPicSmall)
	ON_WM_RBUTTONDOWN()
	ON_COMMAND(IDR_ATTRIBUTEMENU_DELETE, OnAttributemenuDelete)
	ON_WM_PAINT()
	ON_COMMAND(IDR_ATTRIBUTEMENU_ATTRIBUTE, OnAttributemenuAttribute)
	ON_WM_LBUTTONDBLCLK()
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPicSmall message handlers

BOOL CPicSmall::Create(CWnd* pParentWnd) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CDialog::Create(IDD, pParentWnd);
}

void CPicSmall::PostNcDestroy() 
{
	// TODO: Add your specialized code here and/or call the base class
	CDialog::PostNcDestroy();
}

void CPicSmall::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default	
	SetFocus();

	ClientToScreen(&point);

	CPoint pt(0, 0);
	::GetCursorPos(&pt);
	ScreenToClient (&pt);
	CMenu Menu;
	if (Menu.LoadMenu(IDR_ATTRIBUTE_MENU))
	{
		CMenu* pSubMenu = Menu.GetSubMenu(0);

		if (pSubMenu!=NULL)
		{
			pSubMenu->TrackPopupMenu(
			TPM_LEFTALIGN | TPM_RIGHTBUTTON,
			point.x, point.y, this);
		}
	}
}

void CPicSmall::OnAttributemenuDelete() 
{
	// TODO: Add your command handler code here
	GetParent()->SendMessage(WM_MY_DELETE,no,NULL) ;
	DestroyWindow() ;
	delete this ;
}

void CPicSmall::OnPaint() 
{
	CPaintDC dc(this); // device context for painting	
	// TODO: Add your message handler code here
	ShowPic(pPicString,(HWND)m_hWnd,19,19) ; 
	
	// Do not call CDialog::OnPaint() for painting messages
}


void CPicSmall::OnAttributemenuAttribute() 
{
	// TODO: Add your command handler code here
	if (bNew == FALSE)
	{
		pStateDlg = new CFixtureState;
		pStateDlg->Create(this) ;
		bNew = TRUE ;

		pStateDlg->m_channelNum = channel ;
		pStateDlg->m_port = port ;
		pStateDlg->m_name = name ;
		if (channel == 0)
		{
			pStateDlg->GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE) ;
		}
		switch (type)
		{
		case 1 : pStateDlg->m_type.Format(name_PC) ;
			break ;
		case 2 : pStateDlg->m_type.Format(name_Vidicon) ;
			break ;
		case 3 : pStateDlg->m_type.Format(name_Detector) ;
			break ;
		}
		pStateDlg->UpdateData(FALSE) ;
		pStateDlg->m_ipAddr.SetAddress((ULONG)ip) ;
	}
	pStateDlg->ShowWindow(SW_SHOW) ;
}

CPicSmall::~CPicSmall()
{
	if (bNew ==TRUE)
	{
		pStateDlg->DestroyWindow() ;
		delete pStateDlg ;
		pStateDlg = NULL ;
	}
}
 
void CPicSmall::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	if (type == 2)
	{
		CRightLogin* l = CRightLogin::the_one();
		l->PostMessage(ELE_MAP_MSG_OPEN_VEDIO, ip, MAKEDWORD(port, channel));
		CDialog::OnLButtonDblClk(nFlags, point);
	}
}

void CPicSmall::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	bMove = TRUE ;
	GetParent()->SendMessage(WM_MY_MOVE,no,NULL) ;
	CDialog::OnLButtonDown(nFlags, point);
}

void CPicSmall::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	bMove = FALSE ;
	GetParent()->SendMessage(WM_MY_MOVE,-1,NULL) ;
	CDialog::OnLButtonUp(nFlags, point);
}

BOOL CPicSmall::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if( !tip_ctrl.m_hWnd )
	{
		tip_ctrl.Create(this);
		tip_ctrl.Activate(TRUE);
		if(name == "")
		{
			tip_ctrl.AddTool(this, "......");
		}
		else
		{
			tip_ctrl.AddTool(this, name);
		}
	}
	tip_ctrl.RelayEvent(pMsg);
	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -