📄 histdlg.cpp
字号:
// HistDlg.cpp : implementation file
//
#include "stdafx.h"
#include "cvc.h"
#include "HistDlg.h"
#include "windowsx.h"
const int x=50;
const int y=265;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// HistDlg dialog
HistDlg::HistDlg(CWnd* pParent /*=NULL*/)
: CDialog(HistDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(HistDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void HistDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(HistDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(HistDlg, CDialog)
//{{AFX_MSG_MAP(HistDlg)
ON_BN_CLICKED(IDC_BLUEBUT, OnBluebut)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// HistDlg message handlers
void HistDlg::OnBluebut()
{
// TODO: Add your control notification handler code here
CPen *pPen=new CPen;
pPen->CreatePen(PS_SOLID,0,RGB(0,0,255));
CClientDC dc(this);
dc.Rectangle(45,5,320,270);
DrawAxs();
CPen *pOldPen=dc.SelectObject(pPen);
for(int i=0;i<256;i++)
{
dc.MoveTo(x+i,y);
dc.LineTo(x+i,y-bhist[i]);
}
delete dc.SelectObject(pOldPen);
color=3;
}
BOOL HistDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
MoveWindow(100,100,475,425,TRUE);
color=1;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void HistDlg::DrawAxs()
{
CClientDC dc(this);
dc.MoveTo(x,y);
dc.LineTo(x+260,y);
dc.MoveTo(x,y);
dc.LineTo(x,y-260);
dc.LineTo(x-3,y-260+5);
dc.MoveTo(x,y-260);
dc.LineTo(x+3,y-260+5);
dc.MoveTo(x+260,y);
dc.LineTo(x+260-5,y-3);
dc.MoveTo(x+260,y);
dc.LineTo(x+260-5,y+3);
}
void HistDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
if (color==3) OnBluebut();
// Do not call CDialog::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -