CMFCImagePaintArea Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCImagePaintArea Class.

Provides the picture area that you use to modify an image in an image editor dialog box.

class CMFCImagePaintArea : public CButton  

Public Constructors

NameDescription
CMFCImagePaintArea::CMFCImagePaintAreaConstructs a CMFCImagePaintArea object.
CMFCImagePaintArea::~CMFCImagePaintAreaDestructor.

Public Methods

NameDescription
CMFCImagePaintArea::GetModeRetrieves the current drawing mode.
CMFCImagePaintArea::SetBitmapSets the bitmap image for the picture area.
CMFCImagePaintArea::SetColorSets the current drawing color.
CMFCImagePaintArea::SetModeSets the current drawing mode.

Remarks

This class is not intended to be used directly from your code.

The framework uses this class to display the picture area in an image editor dialog box. For more information about the image editor dialog box, see CMFCImageEditorDialog Class.

The following example demonstrates how to construct an object of the CMFCImagePaintArea class, set the current drawing color, set the current drawing mode, and set the bitmap image for the picture area.

	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

Header: afximagepaintarea.h

Constructs a CMFCImagePaintArea object.

CMFCImagePaintArea(CMFCImageEditorDialog* pParentDlg);

Parameters

ParameterDescription
[in] pParentDlgA pointer to the dialog box that is the parent of the image editor.

Retrieves the current drawing mode.

IMAGE_EDIT_MODE GetMode() const;  

Return Value

An IMAGE_EDIT_MODE value that specifies the current drawing mode.

Sets the bitmap image for the picture area.

void SetBitmap(CBitmap* pBitmap);

Parameters

ParameterDescription
[in] pBitmapThe new bitmap image to display.

Remarks

If pBitmap is NULL, this method sets the size of the modifiable paint area to zero. Otherwise, it sets the size of the modifiable paint area to the size of the provided bitmap image.

Sets the current drawing color.

void SetColor(COLORREF color);

Parameters

ParameterDescription
[in] colorThe new drawing color.

Remarks

When you select a color from the image editor palette bar or color picker, the framework calls this method to update the current drawing color. The initial drawing color is black (a COLORREF value of 0).

The drawing color is used by the image editor dialog box for all drawing modes except for IMAGE_EDIT_MODE_COLOR. For more information about drawing modes, see CMFCImagePaintArea::IMAGE_EDIT_MODE Enumeration.

Sets the current drawing mode.

void SetMode(IMAGE_EDIT_MODE mode);

Parameters

ParameterDescription
[in] modeAn IMAGE_EDIT_MODE value that specifies the current drawing mode.

Hierarchy Chart
Classes
CMFCImageEditorDialog Class

Show: