myscrollbar.cpp

来自「VC编写的彩票分析软件源码」· C++ 代码 · 共 65 行

CPP
65
字号
// MyScrollBar.cpp : implementation file
//

#include "stdafx.h"
#include "yilufa.h"
#include "MyScrollBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyScrollBar

CMyScrollBar::CMyScrollBar()
{
}

CMyScrollBar::~CMyScrollBar()
{
}


BEGIN_MESSAGE_MAP(CMyScrollBar, CScrollBar)
	//{{AFX_MSG_MAP(CMyScrollBar)
	ON_WM_CTLCOLOR_REFLECT()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyScrollBar message handlers

HBRUSH CMyScrollBar::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	//pDC->FillSolidRect(0,0,10,10,RGB(255,0,0));
	// TODO: Return a non-NULL brush if the parent's handler should not be called

	CBitmap bim;
	CBitmap* OldBim;
	CRect rc;
	GetClientRect(&rc);
	bim.LoadBitmap(IDB_MAP);

	CBrush br(RGB(0,0,255));
	OldBim=pDC->SelectObject(&bim);
	pDC->FillRect(rc,&(CBrush(&bim)));
	return (HBRUSH(br));
}

void CMyScrollBar::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CRect rc;
	GetClientRect(&rc);
	CBitmap bim;
	bim.LoadBitmap(IDB_MAP);
	dc.FillRect(rc,&(CBrush(&bim)));
	// TODO: Add your message handler code here
	
	// Do not call CScrollBar::OnPaint() for painting messages
}

⌨️ 快捷键说明

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