BOOL CCatchScreenDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
//**************************************************************************
	//把对化框设置成全屏顶层窗口
	SetWindowPos(&wndTopMost,0,0,m_xScreen,m_yScreen,SWP_SHOWWINDOW);
    
	//移动操作提示窗口
	CRect rect;
	m_tipEdit.GetWindowRect(&rect);
    m_tipEdit.MoveWindow(10,10,rect.Width(),rect.Height());

	//显示操作提示窗口文字
	DrawTip();
	
	//捕获按键消息窗口,将对话框的句柄传递到CCatchScreenApp中
	((Cscreen_captureApp *)AfxGetApp())->m_hwndDlg=m_hWnd;
//**************************************************************************

	// 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
	//KillTimer(1001);
	return TRUE;  // return TRUE  unless you set the focus to a control
}
void CXTPSyntaxEditTipWnd::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	CXTPClientRect rClient(this);
	if (IsOwnerDrawn())
		OwnerDrawTip(&dc, rClient);
	else
		DrawTip(&dc, rClient);
}
void CCatchScreenDlg::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
//****************************************************************************************
    
	m_bShowMsg=FALSE;
	m_bDraw=FALSE;
	DrawTip();

	PaintWindow();
//****************************************************************************************
	CDialog::OnLButtonUp(nFlags, point);
}
Exemple #4
0
void CCatchScreenDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
	if(m_bDraw)
	{
		m_rectTracker.m_rect.SetRect(m_startPt.x + 1,m_startPt.y + 1,point.x, point.y);
		m_bDrawTracker=TRUE;
		
		PaintWindow();
	}
	CClientDC dc(this);
	DrawTip(dc);
	CDialog::OnMouseMove(nFlags, point);
}
void CCatchScreenDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
//**************************************************************************************
	   if(m_bDraw)
	   {
			m_rectTracker.m_rect.SetRect(m_startPt.x+1,m_startPt.y+1,point.x,point.y);
			m_bFirstDraw=TRUE;

			PaintWindow();
	   }
	   DrawTip();
//*****************************************************************************************
	CDialog::OnMouseMove(nFlags, point);
}
void CCatchScreenDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
//*****************************************************************************************
	int nHitTest;
	nHitTest=m_rectTracker.HitTest(point);

    //判断击中位置
	if(nHitTest<0)
	{
		if(!m_bFirstDraw)
		{
			//第一次画矩形
			m_startPt=point;
			m_bDraw=TRUE;
			m_bFirstDraw=TRUE;
			//设置当当鼠标按下时最小的矩形大小
			m_rectTracker.m_rect.SetRect(point.x,point.y,point.x+4,point.y+4);	
			
			//保证当鼠标当下时立刻显示信息
			if(m_bFirstDraw)
			  m_bShowMsg=TRUE;		
			DrawTip();
			PaintWindow();
		}
	}
	else
	{
		//保证当鼠标当下时立刻显示信息
		m_bShowMsg=TRUE;		
		PaintWindow();
		
		if(m_bFirstDraw)
		{
			//调束大小时,Track会自动调整矩形大小,在些期间,消息归CRectTracker内部处理
			m_rectTracker.Track(this,point,TRUE);
			//SendMessage(WM_LBUTTONUP,NULL,NULL);
			PaintWindow();

		}
	}
//****************************************************************************************
	CDialog::OnLButtonDown(nFlags, point);
}
void CCatchScreenDlg::OnRButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	//****************************************************************************************
	if(m_bFirstDraw)
	{
		//如果已经截取矩则清除截取矩形
		m_bFirstDraw=FALSE;
		//清除矩形大小
		m_rectTracker.m_rect.SetRect(-1,-1,-1,-1);
		DrawTip();
		PaintWindow();
	}
	else
	{
		 //关闭程序
		 //PostQuitMessage(0);
		OnCancel();
	}
//****************************************************************************************
	CDialog::OnRButtonUp(nFlags, point);
}
Exemple #8
0
void CCatchScreenDlg::CaptureIt()
{
	m_bSleeping = false;
	//截取屏幕到位图中
	CRect rect(0, 0, m_nCXScreen, m_nCYScreen);
	SetRedraw(FALSE);
	m_OrgBackgroundBitmap.Attach(CopyScreenToBitmap(&rect));
	CClientDC dc(this);
	m_BackgroundBitmap.Attach(CreateTransparentColorBitmap(&dc, &m_OrgBackgroundBitmap, rect));
	
	//把对化框设置成全屏顶层窗口
	 SetWindowPos(&wndTopMost, 0, 0, m_nCXScreen, m_nCYScreen, SWP_SHOWWINDOW);

	SetRedraw();
	//移动操作提示窗口
	m_wndTipEdit.GetWindowRect(&rect);
    m_wndTipEdit.MoveWindow(10, 10, rect.Width(), rect.Height());
    
	m_bDrawTracker=FALSE;
	m_rectTracker.m_rect.SetRect(-1, -1, -1, -1);
	PaintWindow();
	//显示操作提示窗口文字
	DrawTip(dc);
}