//Draws a rectangle on the given DC with a NOT ROP2 void WindowMagnetizer::DrawNotRectangle(HDC hDC, CONST LPRECT rect) { int oldROP=SetROP2(hDC,R2_NOT); BEGIN_SELOBJ(hDC,GetStockPen(BLACK_PEN),pen); BEGIN_SELOBJ(hDC,GetStockBrush(NULL_BRUSH),brush); Rectangle(hDC,rect->left,rect->top,rect->right,rect->bottom); END_SELOBJ(hDC,brush); END_SELOBJ(hDC,pen); SetROP2(hDC,oldROP); };
void CDC::Pen(int iObjectID) { HPEN hOldPen = SelectPen(m_hDC, GetStockPen(iObjectID)); // Delete the old one? if (m_bDelOldPen) DeletePen(hOldPen); // This object doesn't need deleting. m_bDelOldPen = FALSE; }
VOID ClearDrawDevice() { HBRUSH brush = GetStockBrush(NULL_BRUSH); SelectBrush(brush); m_switcher.push_back(CGDIHandleSwitcher (m_hDC,brush,TRUE,FALSE)); HPEN pen = GetStockPen(NULL_PEN); SelectPen(pen); m_switcher.push_back(CGDIHandleSwitcher (m_hDC,pen,TRUE,FALSE)); SetBkMode(TRANSPARENT); }
void CDC::Cleanup(void) { // Currently selected pen needs deleting? if (m_bDelOldPen) { HPEN hOldPen = SelectPen(m_hDC, GetStockPen(BLACK_PEN)); DeletePen(hOldPen); } // Currently selected brush needs deleting? if (m_bDelOldBrush) { HBRUSH hOldBrush = SelectBrush(m_hDC, GetStockBrush(WHITE_BRUSH)); DeleteBrush(hOldBrush); } }
/*! テンポラったAAを表示するウインドウの作成 @param[in] hInstance アプリのインスタンス @param[in] hPtWnd メイン窓ウインドウハンドル @return 終了状態コード */ HRESULT DraughtInitialise( HINSTANCE hInstance, HWND hPtWnd ) { WNDCLASSEX wcex; if( hInstance ) { ZeroMemory( &wcex, sizeof(WNDCLASSEX) ); wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = DraughtProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = NULL; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = NULL; wcex.lpszClassName = DRAUGHT_BOARD_CLASS; wcex.hIconSm = NULL; gDraughtAtom = RegisterClassEx( &wcex ); ghNonItemDC = NULL; // サイズ併せ giItemWidth = InitParamValue( INIT_LOAD, VL_THUMB_HORIZ, DTHMSZ_REGULAR ); giItemHeight = InitParamValue( INIT_LOAD, VL_THUMB_VERTI, DTHMSZ_REGULAR ); // サイズ表示用フォント ghAreaFont = CreateFont( FONTSZ_REDUCE, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH, TEXT("MS UI Gothic") ); ghPtWnd = hPtWnd; // 初期状態 //gstMainLsPt.x = -1; gstViewLsPt.x = -1; giItemSel = -1; #ifndef _ORRVW // クルック動作指定ロード・デフォ動作は通常挿入 gdClickDrt = InitParamValue( INIT_LOAD, VL_DRT_LCLICK, MAA_INSERT ); gdSubClickDrt = InitParamValue( INIT_LOAD, VL_DRT_MCLICK, MAA_INSERT ); // Viewerの場合はコピーモードに従う #endif } else { if( ghNonItemDC ) { SelectBitmap( ghNonItemDC, ghOldBmp ); SelectPen( ghNonItemDC, GetStockPen(NULL_PEN) ); DeleteObject( ghNonItemDC ); } if( ghNonItemBMP ){ DeleteBitmap( ghNonItemBMP ); } if( ghLinePen ){ DeletePen( ghLinePen ); } if( ghAreaFont ){ DeleteFont( ghAreaFont ); } #ifdef MAA_TOOLTIP FREE( gptTipBuffer ); #endif DraughtItemDelete( -1 ); } return S_OK; }