CMFCImagePaintArea 类

提供用于在图像编辑器对话框中修改图像的图片区域。

语法

class CMFCImagePaintArea : public CButton

成员

公共构造函数

名称 描述
CMFCImagePaintArea::CMFCImagePaintArea 构造 CMFCImagePaintArea 对象。
CMFCImagePaintArea::~CMFCImagePaintArea 析构函数。

公共方法

名称 描述
CMFCImagePaintArea::GetMode 检索当前绘图模式。
CMFCImagePaintArea::SetBitmap 设置图片区域的位图图像。
CMFCImagePaintArea::SetColor 设置当前绘图颜色。
CMFCImagePaintArea::SetMode 设置当前绘图模式。

注解

此类不可直接通过代码使用。

框架使用此类在图像编辑器对话框中显示图片区域。 有关图像编辑器对话框的详细信息,请参阅 CMFCImageEditorDialog 类

示例

以下示例演示如何构造 CMFCImagePaintArea 类的对象、设置当前绘图颜色、设置当前绘图模式,以及设置图片区域的位图图像。

COLORREF mcolor(RGB(0, 255, 0));
//CBitmap bitmap;
CMFCImageEditorDialog *dialog = new CMFCImageEditorDialog(&bitmap);
CMFCImagePaintArea *wndLargeDrawArea = new CMFCImagePaintArea(dialog);
wndLargeDrawArea->SetColor(mcolor);
wndLargeDrawArea->SetMode(CMFCImagePaintArea::IMAGE_EDIT_MODE_PEN);
wndLargeDrawArea->SetBitmap(&bitmap);

继承层次结构

CObject

CCmdTarget

CWnd

CButton

CMFCImagePaintArea

要求

标头:afximagepaintarea.h

CMFCImagePaintArea::CMFCImagePaintArea

构造 CMFCImagePaintArea 对象。

CMFCImagePaintArea(CMFCImageEditorDialog* pParentDlg);

参数

pParentDlg
[in] 指向作为图像编辑器父级的对话框的指针。

CMFCImagePaintArea::GetMode

检索当前绘图模式。

IMAGE_EDIT_MODE GetMode() const;

返回值

指定当前绘图模式的 IMAGE_EDIT_MODE 值。

CMFCImagePaintArea::SetBitmap

设置图片区域的位图图像。

void SetBitmap(CBitmap* pBitmap);

参数

pBitmap
[in] 要显示的新位图图像。

注解

如果 pBitmap 为 NULL,则此方法将可修改的绘制区域的大小设置为零。 否则,此方法将可修改的绘制区域的大小设置为提供的位图图像的大小。

CMFCImagePaintArea::SetColor

设置当前绘图颜色。

void SetColor(COLORREF color);

参数

color
[in] 新绘图颜色。

备注

从图像编辑器调色板栏或颜色选取器中选择颜色时,框架将调用此方法以更新当前绘图颜色。 初始绘图颜色为黑色(COLORREF 值为 0)。

除 IMAGE_EDIT_MODE_COLOR 之外,所有绘图模式的图像编辑器对话框都使用绘图颜色。 有关绘图模式的详细信息,请参阅 CMFCImagePaintArea::IMAGE_EDIT_MODE 枚举

CMFCImagePaintArea::SetMode

设置当前绘图模式。

void SetMode(IMAGE_EDIT_MODE mode);

参数

mode
[in] 指定当前绘图模式的 IMAGE_EDIT_MODE 值。

另请参阅

层次结构图

CMFCImageEditorDialog 类