pen.cpp
来自「通用网络游戏开发框架」· C++ 代码 · 共 51 行
CPP
51 行
// ============================================================================
// Pen implementation
//
// (c) 2003 Ken Reed
//
// This is free software. You can redistribute it and/or modify it under the
// terms of the GNU General Public License version 2 as published by the Free
// Software Foundation.
// ============================================================================
#include "stdafx.h"
#include "pen.h"
#include <assert.h>
// ============================================================================
// Construction
// ============================================================================
Pen::Pen(HDC hdc, COLORREF colour, int width)
{
shdc = hdc;
pen = CreatePen(PS_SOLID, width, colour);
assert(pen != 0);
SelectObject(hdc, pen);
}
// ============================================================================
// Destruction
// ============================================================================
Pen::~Pen()
{
SelectObject(shdc, old_pen);
DeleteObject(pen);
}
// ============================================================================
// Convert to HPEN
// ============================================================================
Pen::operator HPEN() const
{
return pen;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?