//------------------------------------------------------------------------ //! CGridColumnTraitText - Constructor //------------------------------------------------------------------------ CGridColumnTraitText::CGridColumnTraitText() : m_pOldFont(NULL) , m_TextColor(COLORREF(-1)) , m_BackColor(COLORREF(-1)) , m_SortFormatNumber(false) , m_OldTextColor(COLORREF(-1)) , m_OldBackColor(COLORREF(-1)) {}
void CExtLabel::OnEraseBackground( CDC & dc, const CRect & rcClient ) { ASSERT_VALID( this ); COLORREF clrBackground = GetBkColor(); bool bTransparent = false; if( PmBridge_GetPM()->GetCb2DbTransparentMode(this) && ( clrBackground == COLORREF(-1L) ) ) { CExtPaintManager::stat_ExcludeChildAreas( dc, GetSafeHwnd(), CExtPaintManager::stat_DefExcludeChildAreaCallback ); if( PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this ) ) bTransparent = true; } if( ! bTransparent ) dc.FillSolidRect( &rcClient, (clrBackground != COLORREF(-1L)) ? clrBackground : PmBridge_GetPM()->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) ); }
COLORREF CExtLabel::OnQueryTextColor( bool bEnabled ) const { ASSERT_VALID( this ); COLORREF clrText = GetTextColor( bEnabled ); if( clrText != COLORREF(-1L) ) return clrText; CWindowDC dcFake( NULL ); clrText = PmBridge_GetPM()->QueryObjectTextColor( dcFake, bEnabled, false, false, false, (CObject*)this ); if( clrText != COLORREF(-1L) ) return clrText; clrText = PmBridge_GetPM()->GetColor( bEnabled ? COLOR_BTNTEXT : CExtPaintManager::CLR_TEXT_DISABLED, (CObject*)this ); return clrText; }
LRESULT CPageToolbars::OnColorChangedFinally(WPARAM wParam, LPARAM lParam) { switch( lParam ) { case ID_COLOR_CTRL: m_clrColorCtrl = COLORREF(wParam); if( m_clrColorCtrl == COLORREF(-1) ) AfxMessageBox(_T("Default Color")); else { CString sColor; sColor.Format( _T( "Command from the color control in the menubar\nRGB color is 0x%02X%02X%02X" ), INT( GetRValue(m_clrColorCtrl) ), INT( GetGValue(m_clrColorCtrl) ), INT( GetBValue(m_clrColorCtrl) ) ); AfxMessageBox( sColor ); } break; default: break; } // switch( lParam ) return 0; }
void SystemDraw::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, const int *subpolygon_counts, int subpolygon_count_count, const int *disjunct_polygon_counts, int disjunct_polygon_count_count, Color color, int width, Color outline, uint64 pattern, Color doxor) { GuiLock __; if(vertex_count == 0) return; bool is_xor = !IsNull(doxor); HDC hdc = GetHandle(); if(pattern) { int old_rop = GetROP2(hdc); HGDIOBJ old_brush = GetCurrentObject(hdc, OBJ_BRUSH); word wpat[8] = { (byte)(pattern >> 56), (byte)(pattern >> 48), (byte)(pattern >> 40), (byte)(pattern >> 32), (byte)(pattern >> 24), (byte)(pattern >> 16), (byte)(pattern >> 8), (byte)(pattern >> 0), }; HBITMAP bitmap = CreateBitmap(8, 8, 1, 1, wpat); HBRUSH brush = ::CreatePatternBrush(bitmap); COLORREF old_bk = GetBkColor(hdc); COLORREF old_fg = GetTextColor(hdc); if(!is_xor) { SetROP2(hdc, R2_MASKPEN); SelectObject(hdc, brush); SetTextColor(hdc, Black()); SetBkColor(hdc, White()); SetDrawPen(PEN_NULL, Black); DrawPolyPolyPolygonRaw(*this, vertices, vertex_count, subpolygon_counts, subpolygon_count_count, disjunct_polygon_counts, disjunct_polygon_count_count); SetROP2(hdc, R2_MERGEPEN); SetTextColor(hdc, color); SetBkColor(hdc, Black()); } else { SetROP2(hdc, R2_XORPEN); SetTextColor(hdc, COLORREF(color) ^ COLORREF(doxor)); SelectObject(hdc, brush); } DrawPolyPolyPolygonRaw(*this, vertices, vertex_count, subpolygon_counts, subpolygon_count_count, disjunct_polygon_counts, disjunct_polygon_count_count); SelectObject(hdc, old_brush); SetTextColor(hdc, old_fg); SetBkColor(hdc, old_bk); SetROP2(hdc, old_rop); DeleteObject(brush); DeleteObject(bitmap); if(!IsNull(outline)) { SetColor(Null); SetDrawPen(width, outline); ASSERT(sizeof(POINT) == sizeof(Point)); DrawPolyPolyPolygonRaw(*this, vertices, vertex_count, subpolygon_counts, subpolygon_count_count, disjunct_polygon_counts, disjunct_polygon_count_count); } } else { // simple fill
void Draw::Cinit() { DrawLock __; lastColor = Color::FromCR(COLORREF(-5)); lastPenColor = Color::FromCR(COLORREF(-5)); lastTextColor = COLORREF(-1); lastPen = Null; actBrush = orgBrush = NULL; actPen = orgPen = NULL; orgFont = NULL; lastFont.Clear(); }
Style::Style() : _styleID(-1), _fgColor(COLORREF(-1)), _bgColor(COLORREF(-1)), _colorStyle(COLORSTYLE_ALL), _fontStyle(-1), _fontSize(-1), _keywordClass(-1), _keywords(NULL) { }
void CViewBar::OnInitialUpdate() { CListView::OnInitialUpdate(); m_imageViews.Create(IDB_VIEWS, 32, 4, COLORREF(RGB(0,0,0))); GetListCtrl().SetImageList(&m_imageViews, LVSIL_NORMAL); GetListCtrl().ModifyStyle(LVS_TYPEMASK, LVS_ICON); GetListCtrl().InsertItem(0, TEXT("Today"), 0); GetListCtrl().InsertItem(1, TEXT("Calendar"), 1); GetListCtrl().InsertItem(2, TEXT("Customers"), 2); GetListCtrl().InsertItem(3, TEXT("Reports"), 3); GetListCtrl().SetTextColor(COLORREF(RGB(255,255,255))); GetListCtrl().SetTextBkColor(GetSysColor(COLOR_3DSHADOW)); }
CGradientProgressCtrl::CGradientProgressCtrl() { m_nLower=0; m_nUpper=100; m_nCurrentPosition=0; m_nStep=10; //Initial Color of show m_clrStart= COLORREF(RGB(255,0,0)); m_clrEnd= COLORREF(RGB(0,0,255)); m_clrBkGround=::GetSysColor(COLOR_3DFACE); m_clrText=COLORREF(RGB(255,255,255)); //Not show Word m_bShowPercent=FALSE; }
CExtAviLabel::CExtAviLabel() : m_nAviTimerID( 400 ) , m_nAviFrameFrom( 0 ) , m_nAviFrameTo( UINT(-1) ) , m_nRep( UINT(-1) ) , m_dwAviStyle( __EXT_AVI_DEFAULT_STYLES ) , m_bSeek( false ) , m_bPlaying( false ) , m_lfAviSpeedRate( 1.0 ) , m_clrTransparent( COLORREF(-1L) ) , m_clrTransparentEffective( COLORREF(-1L) ) { _Impl_Init(); ::AVIFileInit(); }
//------------------------------------------------------------------------ //! Changes the text color if one is specified //! //! @param nRow The index of the row //! @param textColor Current text color //! @return New text color was specified (true / false) //------------------------------------------------------------------------ bool CGridRowTraitText::UpdateTextColor(int nRow, COLORREF& textColor) { if (m_AltTextColor!=COLORREF(-1) && nRow % 2) { textColor = m_AltTextColor; return true; } if (m_TextColor!=COLORREF(-1)) { textColor = m_TextColor; return true; } return false; }
//------------------------------------------------------------------------ //! Changes the background color if one is specified //! //! @param nRow The index of the row //! @param backColor Current background color //! @return New background color was specified (true / false) //------------------------------------------------------------------------ bool CGridRowTraitText::UpdateBackColor(int nRow, COLORREF& backColor) { if (m_AltBackColor!=COLORREF(-1) && nRow % 2) { backColor = m_AltBackColor; return true; } if (m_BackColor!=COLORREF(-1)) { backColor = m_BackColor; return true; } return false; }
int CMDITabsDialogBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (__super::OnCreate(lpCreateStruct) == -1) return -1; _fNavigatingViaTravelLog = false; const double c_rgHueAdjust[] = { 0.0, // none 0.0, // game 0.4, // view 0.0, // pic -1.0, // script -0.8, // vocab -0.3, // font 0.8, // cursor 0.3, // text -0.6, // sound 0.0, // room explorer }; const double c_rgSatAdjust[] = { 0.0, // none -1.0, // game 0.0, // view 0.0, // pic 0.0, // script 0.0, // vocab 0.0, // font 0.0, // cursor 0.0, // text 0.0, // sound 0.0, // room explorer }; ASSERT(ARRAYSIZE(c_rgHueAdjust) == ARRAYSIZE(_tabBitmap)); for (int i = 0; i < ARRAYSIZE(c_rgHueAdjust); ++i) { _tabBitmap[i].LoadBMP_Resource(MAKEINTRESOURCE(IDB_TABPIC)); _tabBitmap[i].AdjustHLS(COLORREF(-1L), RGB(0, 0, 0), c_rgHueAdjust[i], 0.0, c_rgSatAdjust[i], NULL); _tabBitmapNS[i].LoadBMP_Resource(MAKEINTRESOURCE(IDB_TABPICNS)); _tabBitmapNS[i].AdjustHLS(COLORREF(-1L), RGB(0, 0, 0), c_rgHueAdjust[i], 0.0, c_rgSatAdjust[i], NULL); } return 0; }
CGradientProgressCtrl::CGradientProgressCtrl() { // Defaults assigned by CProgressCtrl() m_nLower = 0; m_nUpper = 100; m_nCurrentPosition = 0; m_nStep = 10; // Initial colors m_clrStart = COLORREF(RGB(255, 0,0)); m_clrEnd = COLORREF(RGB(0,0,255)); m_clrBkGround = ::GetSysColor(COLOR_3DFACE); m_clrText = COLORREF(RGB(255, 255, 255)); // Initial show percent m_bShowPercent = TRUE; }
COLORREF CExtAviLabel::OnAviCalcTransparentColor() { ASSERT_VALID( this ); if( GetSafeHwnd() == NULL || AviIsEmpty() ) return COLORREF(-1L); if( m_clrTransparent != COLORREF(-1L) ) return m_clrTransparent; ASSERT( m_pAS != NULL ); ASSERT( m_pGF != NULL ); LPBITMAPINFO pBI = (LPBITMAPINFO)::AVIStreamGetFrame( m_pGF, 0 ); ASSERT( pBI != NULL ); if( pBI == NULL || pBI->bmiHeader.biBitCount != 8 ) return COLORREF(-1L); LPBYTE lpbyIndex = (LPBYTE)( (DWORD)pBI + pBI->bmiHeader.biSize + (pBI->bmiHeader.biClrUsed*sizeof(RGBQUAD)) ); RGBQUAD * pRGBFirst = (RGBQUAD*)(&pBI->bmiColors[*lpbyIndex]); return RGB( pRGBFirst->rgbRed, pRGBFirst->rgbGreen, pRGBFirst->rgbBlue ); }
bool CGridColumnTraitText::UpdateTextColor(COLORREF& textColor) { if (m_TextColor!=COLORREF(-1)) { textColor = m_TextColor; return true; } return false; }
//------------------------------------------------------------------------ //! Changes the background color if one is specified //! //! @param pLVCD Pointer to NMLVCUSTOMDRAW structure //! @param backColor Current background color //! @return New background color was specified (true / false) //------------------------------------------------------------------------ bool CGridColumnTraitText::UpdateBackColor(NMLVCUSTOMDRAW* pLVCD, COLORREF& backColor) { if (m_BackColor != COLORREF(-1)) { backColor = m_BackColor; return true; } return false; }
CColorProgressCtrl::CColorProgressCtrl() { m_nLower=0; m_nUpper=100; m_nCurrentPosition=0; m_nStep=10; m_clrBkGround=::GetSysColor(COLOR_3DFACE); m_clrText=COLORREF(RGB(255,255,255)); }
CExtLabel::CExtLabel() : m_bFontBold(false) , m_bFontItalic(false) , m_bFontUnderline(false) , m_bFontStrikeOut(false) , m_clrTextNormal( COLORREF(-1L) ) , m_clrTextDisabled( COLORREF(-1L) ) , m_clrBackground( COLORREF(-1L) ) , m_bInitText(false) , m_sText( _T("") ) , m_eImageMode( eAlign ) , m_nAdvancedTipStyle( INT(CExtPopupMenuTipWnd::__ETS_RECTANGLE_NO_ICON) ) , m_bHelper_AutoAdjust_SS_NOTIFY_style( CExtLabel::g_bHelper_AutoAdjust_SS_NOTIFY_style ) , m_rcLabelTextMargins( 0, 0, 0, 0 ) { m_bmp.Empty(); PmBridge_Install(); }
bool CGridColumnTraitText::UpdateBackColor(COLORREF& backColor) { if (m_BackColor!=COLORREF(-1)) { backColor = m_BackColor; return true; } return false; }
LRESULT CPageToolbars::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam) { lParam; CExtPopupMenuWnd::MsgPrepareMenuData_t * pData = reinterpret_cast < CExtPopupMenuWnd::MsgPrepareMenuData_t * > ( wParam ); ASSERT( pData != NULL ); CExtPopupMenuWnd * pPopup = pData->m_pPopup; ASSERT( pPopup != NULL ); INT nReplacePos = pPopup->ItemFindPosForCmdID(ID_COLOR_CTRL); if( nReplacePos >= 0 ) { CExtPopupColorMenuWnd * pColorPopup = new CExtPopupColorMenuWnd; pColorPopup->m_lParamCookie = LPARAM(ID_COLOR_CTRL); pColorPopup->m_hWndNotifyColorChanged = GetSafeHwnd(); pColorPopup->m_clrDefault = COLORREF(-1); pColorPopup->m_clrInitial = m_clrColorCtrl; VERIFY( pPopup->ItemInsertSpecPopup( pColorPopup, nReplacePos + 1, pPopup->ItemGetText(nReplacePos), pPopup->ItemGetIcon(nReplacePos) ) ); pPopup->ItemSetDisplayed( nReplacePos + 1, true ); VERIFY( pPopup->ItemRemove(nReplacePos) ); } // if( nReplacePos >= 0 ) #if (!defined __EXT_MFC_NO_DATE_PICKER) nReplacePos = pPopup->ItemFindPosForCmdID(ID_DATE_PICKER_CTRL); if( nReplacePos >= 0 ) { CExtPopupControlMenuWnd::g_bControlMenuWithShadows = true; CExtPopupDatePickerMenuWnd * pDatePickerPopup = new CExtPopupDatePickerMenuWnd; VERIFY( pPopup->ItemInsertSpecPopup( pDatePickerPopup, nReplacePos + 1, pPopup->ItemGetText(nReplacePos), pPopup->ItemGetIcon(nReplacePos) ) ); pPopup->ItemSetDisplayed( nReplacePos + 1, true ); VERIFY( pPopup->ItemRemove(nReplacePos) ); } // if( nReplacePos >= 0 ) #endif // #if (!defined __EXT_MFC_NO_DATE_PICKER) return TRUE; }
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { //OutputDebugString((LPCSTR)hwnd); PAINTSTRUCT paintStruct; static HDC hDC; static HGLRC hRC; HWND hWndButton; char string[] = "Hello World!"; switch(message) { case WM_CREATE: hWndButton=CreateWindowEx(NULL, "BUTTON", "OK", WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON, 50, 220, 100, 24, hwnd, (HMENU)IDC_MAIN_BUTTON, GetModuleHandle(NULL), NULL); hDC = GetDC(hwnd); hRC = wglCreateContext(hDC); wglMakeCurrent(hDC, hRC); break; case WM_DESTROY: wglMakeCurrent(hDC, NULL); wglDeleteContext(hRC); PostQuitMessage(0); case WM_CLOSE: PostQuitMessage(0); break; case WM_PAINT: hDC = BeginPaint(hwnd, &paintStruct); SetTextColor(hDC, COLORREF(0x00ff0000)); TextOut(hDC, 150, 150, string, sizeof(string)-1); EndPaint(hwnd, &paintStruct); return 0; break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_MAIN_BUTTON: MessageBox(hwnd, "Button OK wurde geklickt", "ClickEvent", NULL); break; default: break; } default: break; } return (DefWindowProc(hwnd, message, wParam, lParam)); }
CPnt5::CPnt5(int x, int y) { mp.x = x; mp.y = y; for (size_t i = 0; i < EPD_MAX; i++) { ac[i] = COLORREF(0x000000); } tp.x = 0; tp.y = 0; }
CPnt5::CPnt5(POINT pnt) { mp.x = pnt.x; mp.y = pnt.y; for (size_t i = 0; i < EPD_MAX; i++) { ac[i] = COLORREF(0x000000); } tp.x = 0; tp.y = 0; }
CPnt5::~CPnt5() { mp.x = 0; mp.y = 0; for (size_t i = 0; i < EPD_MAX; i++) { ac[i] = COLORREF(0x000000); } tp.x = 0; tp.y = 0; }
DLLEXP int snaph(HWND hwn) { if ( !IsWindow(hwn) )return false; CRect rct; GetWindowRect(hwn,&rct); g_snap_height=rct.Height(); g_snap_width=rct.Width(); g_memdc.FillSolidRect(0,0,g_scn_width,g_scn_height,COLORREF(0)); g_memdc.BitBlt(0,0,g_snap_width,g_snap_height,g_pdc_dsk,rct.left,rct.top,SRCCOPY); return g_bitmap.GetBitmapBits(g_scn_height*g_scn_width*4,g_buf_clr); }
void CDlg_Search::InitObjects() { m_fontNormal.CreateFont(12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_SWISS, DEFAULT_APPLICATION_FONT); m_fontNormalB.CreateFont(14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_SWISS, DEFAULT_APPLICATION_FONT); m_fontNormalBUl.CreateFont(14, 0, 0, 0, FW_NORMAL, FALSE, TRUE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_SWISS, DEFAULT_APPLICATION_FONT); m_bmpSrchBg.LoadBitmap(IDB_SRCH_DLG_BG); m_bmpSrchBg.GetBitmap(&m_bitmapSrchBg); m_penedtRect.CreatePen(PS_SOLID, 1, COLORREF(RGB(0x97, 0xb8, 0xc9))); }
CExtProgressWnd::CExtProgressWnd() : m_clrProgressBarFrom( COLORREF(-1L) ) , m_clrProgressBarTo( COLORREF(-1L) ) , m_clrBackgroundArea( COLORREF(-1L) ) , m_lfEnlightClrProgressBarFrom( -0.25 ) , m_lfEnlightClrProgressBarTo( 0.25 ) , m_clrBorderLT( COLORREF(-1L) ) , m_clrBorderRB( COLORREF(-1L) ) , m_sizeBorderSpace( 2, 2 ) , m_sizeDistanceBetweenBlocks( 2, 2 ) , m_sizeBlockScaleFactorH( 7, 10 ) , m_sizeBlockScaleFactorV( 7, 10 ) , m_bHasBorder( true ) , m_bHorizontalGradientBars( true ) , m_bImmediateUpdating( true ) , m_bUsePaintManager( true ) , m_bEndlessMode( false ) , m_nEndlessNominator( 1 ) , m_nEndlessDenominator( 3 ) { }
void CPathObject::Draw(CDC* pDC){ COLORREF color; if(IsSelected) color=COLORREF(RGB(255,0,0)); else color=COLORREF(RGB(0,0,0)); CPen pen(PS_SOLID,2,color); CPen *pOldPen=NULL; pOldPen=pDC->SelectObject(&pen); double angle=CalcAngle(headnode->centre.x-endnode->centre.x, headnode->centre.y-endnode->centre.y); CPoint pt1,pt2; pt1=GetAnglePoint(headnode->centre.x,headnode->centre.y,radius,radius,(int)(angle+180)); pt2=GetAnglePoint(endnode->centre.x,endnode->centre.y,radius,radius,(int)(angle)); pDC->MoveTo(pt1); pDC->LineTo(pt2); CPoint point(endnode->centre.x/3+headnode->centre.x*2/3, endnode->centre.y/3+headnode->centre.y*2/3); CPoint point1(endnode->centre.x/8+headnode->centre.x*7/8, endnode->centre.y/8+headnode->centre.y*7/8-5); pt1=GetAnglePoint(point.x,point.y,arrow,arrow,(int)(angle+14)); pt2=GetAnglePoint(point.x,point.y,arrow,arrow,(int)(angle-14)); pDC->MoveTo(point); pDC->LineTo(pt1); pDC->MoveTo(point); pDC->LineTo(pt2); char buf[20]; sprintf(buf,"%d",weight); pDC->SetTextColor(RGB(0,0,255)); pDC->TextOut( point1.x, point1.y ,buf ); }
inline void _DrawLine(HDC hdc, int x1, int y1, int dx, int dy, int stepper_x(int x), int stepper_y(int y), void DrawPixel(HDC hDC, int y1, int x1, COLORREF color)) { int d1 = 2 * dy - 2 * dx, d2 = 2 * dy; int seg = d1 + dx; int x2 = x1 + dx; while (x1 < x2) { x1++; if (seg > 0) { seg += d1; y1++; } else seg += d2; DrawPixel(hdc, x1, y1, COLORREF(RGB(0, 0, 0))); } }