brush.cpp

来自「通用网络游戏开发框架」· C++ 代码 · 共 51 行

CPP
51
字号
// ============================================================================
// Brush 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 "brush.h"

#include <assert.h>


// ============================================================================
// Construction
// ============================================================================

Brush::Brush(HDC hdc, COLORREF colour)
{
   shdc = hdc;

   brush = CreateSolidBrush(colour);
   assert(brush != 0);

   SelectObject(hdc, brush);
}


// ============================================================================
// Destruction
// ============================================================================

Brush::~Brush()
{
   SelectObject(shdc, old_brush);
   DeleteObject(brush);
}


// ============================================================================
// Convert to HBRUSH
// ============================================================================

Brush::operator HBRUSH() const
{
   return brush;
}

⌨️ 快捷键说明

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