?? draw.cpp
字號:
#include "stdafx.h"
#include "draw.h"
draw::draw(HWND hwnd,HDC memdc)
{
m_hwnd=hwnd;
m_memdc=memdc;
m_spen=(HPEN)GetStockObject(BLACK_PEN);
m_sbrush=(HBRUSH)GetStockObject(BLACK_BRUSH);
}
draw::~draw()
{
}
void draw::drawrectangle(int x1,int y1,int x2,int y2,int pencolor,int backcolor)
{
HDC hdc;
HPEN thepen;
HBRUSH thebrush;
hdc=GetDC(m_hwnd);
thepen=CreatePen(PS_SOLID,1,pencolor);
thebrush=CreateSolidBrush(backcolor);
SelectObject(hdc,thepen);
SelectObject(hdc,thebrush);
Rectangle(hdc,x1,y1,x2,y2);
SelectObject(m_memdc,thepen);
SelectObject(m_memdc,thebrush);
Rectangle(m_memdc,x1,y1,x2,y2);
SelectObject(hdc,m_spen);
SelectObject(hdc,m_sbrush);
SelectObject(m_memdc,m_spen);
SelectObject(m_memdc,m_sbrush);
DeleteObject(thepen);
DeleteObject(thebrush);
ReleaseDC(m_hwnd,hdc);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -