本文整理汇总了C++中MainWindow::ChangeCurrentColor方法的典型用法代码示例。如果您正苦于以下问题:C++ MainWindow::ChangeCurrentColor方法的具体用法?C++ MainWindow::ChangeCurrentColor怎么用?C++ MainWindow::ChangeCurrentColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow::ChangeCurrentColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MainWndProc
//.........这里部分代码省略.........
case IDM_DRAW_RECTANGLE:
SendMessage(Exo.hWndToolbar, TB_SETSTATE, IDM_DRAW_RECTANGLE, TBSTATE_CHECKED | TBSTATE_ENABLED);
Exo.ChangeCurrentCursor(hwnd, MAKEINTRESOURCE(IDC_RECTANGLE));
break;
case IDM_DRAW_CIRCLE:
SendMessage(Exo.hWndToolbar, TB_SETSTATE, IDM_DRAW_CIRCLE, TBSTATE_CHECKED | TBSTATE_ENABLED);
Exo.ChangeCurrentCursor(hwnd, MAKEINTRESOURCE(IDC_CIRCLE));
break;
case IDM_DRAW_BEZIER:
SendMessage(Exo.hWndToolbar, TB_SETSTATE, IDM_DRAW_BEZIER, TBSTATE_CHECKED | TBSTATE_ENABLED);
Exo.ChangeCurrentCursor(hwnd, MAKEINTRESOURCE(IDC_CIRCLE));
myBezier.DrawBezier(hdc, apt);
break;
case IDM_ERAZER:
SendMessage(Exo.hWndToolbar, TB_SETSTATE, IDM_ERAZER, TBSTATE_CHECKED | TBSTATE_ENABLED);
Exo.ChangeCurrentCursor(hwnd, MAKEINTRESOURCE(IDC_ERAZER));
break;
}
break;
//The following 3 cases are for drawing lines in my drawing area
case WM_LBUTTONDOWN:
if (xMouse > 20 && xMouse < 410 && yMouse > 50 && yMouse < 500 )
{
//Draw freehand
if( SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_DRAW_FREEHAND, 0) & TBSTATE_CHECKED )
{
if(SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_FILE_NEW, 0) & TBSTATE_CHECKED)
Exo.ChangeCurrentColor(hdc,strokePen,RGB(0,0,255), alfa);
if(SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_FILE_OPEN, 0) & TBSTATE_CHECKED)
Exo.ChangeCurrentColor(hdc,strokePen, RGB(0,255,0), alfa);
if(SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_FILE_SAVE, 0) & TBSTATE_CHECKED)
Exo.ChangeCurrentColor(hdc,strokePen, RGB(0,0,0), alfa);
if(SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_FILE_PRINT, 0) & TBSTATE_CHECKED)
Exo.ChangeCurrentColor(hdc,strokePen, RGB(255,0,0), alfa);
hdc = GetDC(hwnd);
StartX = LOWORD(lParam);
StartY = HIWORD(lParam);
EndX = LOWORD(lParam);
EndY = HIWORD(lParam);
SetROP2(hdc, R2_XORPEN);
MoveToEx(hdc, StartX, StartY, NULL);
LineTo(hdc, EndX, EndY);
isDrawing = TRUE;
ReleaseDC(hwnd, hdc);
Exo.DeleteObjectHPEN(strokePen);
}
// If the Line button is down, draw with it
if( SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_DRAW_LINE, 0) & TBSTATE_CHECKED )
{
if(SendMessage(Exo.hWndToolbar, TB_GETSTATE, IDM_FILE_NEW, 0) & TBSTATE_CHECKED)
Exo.ChangeCurrentColor(hdc,strokePen, RGB(0,0,255), alfa);