• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetSysColor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetSysColor函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSysColor函数的具体用法?C++ GetSysColor怎么用?C++ GetSysColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetSysColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: memset

void CTreeList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
    PULONG  pMagic = (PULONG) lpDrawItemStruct->itemData;

    TCHAR  lpBuffer[256];
    LV_ITEM lvi;
    LV_COLUMN lvc, lvcprev ;

    memset(lpBuffer, 0, 256);
    lvi.mask = LVIF_TEXT | LVIF_PARAM ;
    lvi.iItem = lpDrawItemStruct->itemID ;  
    lvi.iSubItem = 0;
    lvi.pszText = lpBuffer ;
    lvi.cchTextMax = sizeof(lpBuffer);
    GetItem(&lvi);
    ::ZeroMemory(&lvc, sizeof(lvc));
    ::ZeroMemory(&lvcprev, sizeof(lvcprev));
    lvc.mask = LVCF_WIDTH |LVCF_FMT;
    lvcprev.mask = LVCF_WIDTH | LVCF_FMT;

    CDC* pDC;
    pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
    int nCol;
    CRect rcText = lpDrawItemStruct->rcItem;

    CFont Fnt, *pOldFont = NULL;
    LOGFONT lf;

    int cyPixels = pDC->GetDeviceCaps(LOGPIXELSY);
    memset(&lf, 0, sizeof(LOGFONT));

    if (pMagic == NULL) {
        return;
    }

    if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {

        if (IsVistaOrAbove()) {
            lstrcpy(lf.lfFaceName, "MS Sans Serif"); /*Courier New*/
            lf.lfHeight = -MulDiv(8, cyPixels, 72);
            lf.lfWeight = TRUE;
        } else {
            lstrcpy(lf.lfFaceName, "Arial Black"); /*Courier New*/
            lf.lfHeight = -MulDiv(8, cyPixels, 72);
            lf.lfWeight = TRUE;
        }
    } else {
        lstrcpy(lf.lfFaceName, "MS Sans Serif");
        lf.lfHeight = -MulDiv(8, cyPixels, 72);
    }

    Fnt.CreateFontIndirect(&lf);
    pOldFont = (CFont *) pDC->SelectObject(&Fnt);

    /* loading bitmap */
    if (m_hBitmap == NULL) {
        m_hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL), 
                             MAKEINTRESOURCE(IDB_LINE_SEP),
                             IMAGE_BITMAP, 0, 0, 0);

        if (m_hBitmap) {
            m_hMemDC  = ::CreateCompatibleDC(this->GetDC()->m_hDC);
            m_hOldBmp = (HBITMAP)::SelectObject(m_hMemDC, m_hBitmap);
        }
    }

    if (TRUE) {

        if (!m_SelectionFlag) {
            for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
                if (nCol > 0) {
                    GetSubItemRect(lpDrawItemStruct->itemID, 
                        nCol,LVIR_BOUNDS, m_SelectionRect);
                } else {
                    GetItemRect(lpDrawItemStruct->itemID, 
                             m_SelectionRect,LVIR_BOUNDS);
                    m_SelectionRect.right = GetColumnWidth(0);
                    m_SelectionRect.left = 0;
                }

                if (m_SelectionRect.PtInRect(m_Point)) {
                    m_SelectionFlag = TRUE;
                    break;
                } else {
                    m_SelectionFlag = FALSE;
                }
            } 
        }
 
        if ((lpDrawItemStruct->itemState & ODS_SELECTED) && m_SelectionFlag ) {

            CRect rc = lpDrawItemStruct->rcItem;
            rc.left  += 4; rc.right -= 4;
            rc.top   += 1; rc.bottom -= 0;
            if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
                rc.bottom -= 3; rc.top -= 1;
                rc.right = (rc.Width() * 7 / 8) + rc.left;
            }
            pDC->FillSolidRect(&rc, GetSysColor(m_bFocus ? COLOR_HIGHLIGHT : COLOR_INACTIVEBORDER));
        } else {
//.........这里部分代码省略.........
开发者ID:Axure,项目名称:Ext3Fsd,代码行数:101,代码来源:TreeList.cpp


示例2: rcLabel

void CHeaderCtrlEx::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
	CDC dc;

	dc.Attach( lpDrawItemStruct->hDC );

	// Get the column rect
	CRect rcLabel( lpDrawItemStruct->rcItem );

	// Save DC
	int nSavedDC = dc.SaveDC();

	// Set clipping region to limit drawing within column
	CRgn rgn;
	rgn.CreateRectRgnIndirect( &rcLabel );
	dc.SelectObject( &rgn );
	rgn.DeleteObject();

		// Draw the background
		dc.FillRect(rcLabel, &CBrush(::GetSysColor(COLOR_3DFACE)));
	
	// Labels are offset by a certain amount  
	// This offset is related to the width of a space character
	int offset = dc.GetTextExtent(L" ", 1 ).cx*2;


	// Get the column text and format
	wchar_t buf[256];
	HD_ITEM hditem;
	
	hditem.mask = HDI_TEXT | HDI_FORMAT;
	hditem.pszText = buf;
	hditem.cchTextMax = 255;

	GetItem( lpDrawItemStruct->itemID, &hditem );

	// Determine format for drawing column label
	UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP 
						| DT_VCENTER | DT_END_ELLIPSIS ;

	if( hditem.fmt & HDF_CENTER)
		uFormat |= DT_CENTER;
	else if( hditem.fmt & HDF_RIGHT)
		uFormat |= DT_RIGHT;
	else
		uFormat |= DT_LEFT;

	// Adjust the rect if the mouse button is pressed on it
	if( lpDrawItemStruct->itemState == ODS_SELECTED )
	{
		rcLabel.left++;
		rcLabel.top += 2;
		rcLabel.right++;
	}

	// Adjust the rect further if Sort arrow is to be displayed
	if( lpDrawItemStruct->itemID == (UINT)m_nSortCol )
	{
		rcLabel.right -= 3 * offset;
	}

	rcLabel.left += offset;
	rcLabel.right -= offset;

	// Draw column label
    if( rcLabel.left <rcLabel.right ) dc.DrawText(buf,-1,rcLabel, uFormat); // Draw the Sort arrow if( lpDrawItemStruct->itemID == (UINT)m_nSortCol )
	{
		CRect rcIcon( lpDrawItemStruct->rcItem );

		// Set up pens to use for drawing the triangle
		CPen penLight(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
		CPen penShadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
		CPen *pOldPen = dc.SelectObject( &penLight );

		if( m_bSortAsc )
		{
			// Draw triangle pointing upwards
			dc.MoveTo( rcIcon.right - 2*offset, offset-1);
			dc.LineTo( rcIcon.right - 3*offset/2, rcIcon.bottom - offset );
			dc.LineTo( rcIcon.right - 5*offset/2-2, rcIcon.bottom - offset );
			dc.MoveTo( rcIcon.right - 5*offset/2-1, rcIcon.bottom - offset-1 );

			dc.SelectObject( &penShadow );
			dc.LineTo( rcIcon.right - 2*offset, offset-2);
		}
		else
		{
			// Draw triangle pointing downwords
			dc.MoveTo( rcIcon.right - 3*offset/2, offset-1);
			dc.LineTo( rcIcon.right - 2*offset-1, rcIcon.bottom - offset + 1 );
			dc.MoveTo( rcIcon.right - 2*offset-1, rcIcon.bottom - offset );

			dc.SelectObject( &penShadow );
			dc.LineTo( rcIcon.right - 5*offset/2-1, offset -1 );
			dc.LineTo( rcIcon.right - 3*offset/2, offset -1);
		}

		// Restore the pen
		dc.SelectObject( pOldPen );
	}
//.........这里部分代码省略.........
开发者ID:leiqunni,项目名称:STEP_Unicode,代码行数:101,代码来源:HeaderCtrlEx.cpp


示例3: GetWindowRect

void CXPEdit::DrawEdge(void)
{
	if ( !( GetStyle() & WS_BORDER ) && !( GetExStyle() & WS_EX_CLIENTEDGE ) )
		return;

	BOOL bHaveScrollBar = FALSE;
	
	CRect rect;
	GetWindowRect ( rect );
	ScreenToClient( rect );

	CDC *pDC = GetDC ();
	int nSaveDC = pDC->SaveDC();

	COLORREF BorderColor, HotColor;
	
	BorderColor = RGB(127, 157, 185);
	HotColor = pDC->GetPixel( rect.left + 2, rect.top + 2 );
	
	if ( !( GetStyle() & ES_READONLY ) && IsWindowEnabled() ) 
	{
		HotColor = RGB( 255, 255, 255 );
		if ( m_bIsFocused )
			BorderColor = RGB(127, 157, 255);

		if ( m_bIsMouseOver )
			HotColor = RGB( 253, 216, 137 );
		else if ( (GetStyle() & WS_VSCROLL) || (GetStyle() & WS_HSCROLL) ) 
			bHaveScrollBar = TRUE;
	}

	CPen pen1, pen2, pen3;
	pen1.CreatePen( PS_SOLID, 1, BorderColor );
	pen2.CreatePen( PS_SOLID, 1, HotColor );
	pen3.CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNFACE) );

	pDC->SelectStockObject( NULL_BRUSH );
	pDC->SelectObject( &pen1 );

	pDC->Rectangle( rect );

	
    rect.DeflateRect( 1, 1 );
	pDC->SelectObject( &pen2 );
	
	if ( !bHaveScrollBar )
		pDC->Rectangle( rect );
	else
	{
		rect.DeflateRect(0,0,1,1);

		pDC->MoveTo( rect.left, rect.bottom );
		pDC->LineTo( rect.left, rect.top );
		pDC->LineTo( rect.right, rect.top );

		if ( GetStyle() & WS_VSCROLL )
			pDC->SelectObject( &pen3 );
		pDC->LineTo( rect.right, rect.bottom );

		pDC->SelectObject( &pen2 );
		if ( GetStyle() & WS_HSCROLL )
			pDC->SelectObject( &pen3 );
		pDC->LineTo( rect.left, rect.bottom );
	}
	

	pDC->RestoreDC( nSaveDC );
	ReleaseDC ( pDC);
}
开发者ID:Lichanglu,项目名称:ENC-1260,代码行数:69,代码来源:XPEdit.cpp


示例4: CreateSolidBrush

void CBadTrustDialog::OnInitDialog()
    {
    //
    // Get the background brush for our edit controls
    //
    m_hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));

    // Load the icon
    LPSTR idi;
    switch (m_rrn.hrValid)
        {
    case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND):
    case TRUST_E_NOSIGNATURE:
        idi = IDI_EXCLAMATION;
        break;
    default:
        idi = IDI_HAND;
        break;
        }
    HICON hicon = LoadIcon(NULL, idi);
    ::SendDlgItemMessage(m_hWnd, IDC_BADTRUSTICON, STM_SETICON, (WPARAM)hicon, (LPARAM)0);

    // Set the window title
		{
		TCHAR sz[128];
        WideCharToMultiByte(CP_ACP, 0, m_rrn.wszDialogTitle, -1, (LPSTR)sz, 128, NULL, NULL);
		::SetWindowText(GetWindow(), sz);
		}

    // Set the banter text
    int cchBanter2;
        {
        const int cchMax = INTERNET_MAX_URL_LENGTH+64;
        TCHAR sz[cchMax];

        // Set the top level banter
        ::LoadString(hinst, IDS_BADTRUSTBANTER1, &sz[0], cchMax);
        ::SetWindowText(WindowOf(IDC_BADTRUSTBANTER1), &sz[0]);

        // Set the program name
            {
            //
            // The 'program' name we see can in fact often be a full URL. URLs
            // can be very long, up to 1024 or so.
            //
            if (m_rrn.wszProgramName)
                {
                WideCharToMultiByte(CP_ACP, 0, m_rrn.wszProgramName, -1, &sz[0], cchMax, NULL, NULL);
                }
            else
                ::LoadString(hinst, IDS_UNKNOWNPROGRAM, &sz[0], cchMax);

            TCHAR szF[cchMax];
            ::FormatMessage(hinst, &szF[0], cchMax, IDS_BADTRUSTBANTER2, &sz[0]);

            ::SetWindowText(WindowOf(IDC_BADTRUSTBANTER2), &szF[0]);
            cchBanter2 = lstrlen(&szF[0]);

            //
            // This control is read-only. Note that the text on the control
            // can be copied using the context menu in the control.
            //
            SendMessage(WindowOf(IDC_BADTRUSTBANTER2), EM_SETREADONLY, (WPARAM)TRUE, 0);
            }

        // Set the trailing banter
        UINT ids;
        switch (m_rrn.hrValid)
            {
        case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND):
        case TRUST_E_NOSIGNATURE:
            ids = IDS_BADTRUSTBANTER31;
            break;
        case CERT_E_EXPIRED:
        case CERT_E_VALIDIYPERIODNESTING:
            ids = IDS_BADTRUSTBANTER32;
            break;
        case NTE_BAD_SIGNATURE:
            ids = IDS_BADTRUSTBANTER33;
            break;
        default:
            ids = IDS_BADTRUSTBANTER34;
            break;
            }
        ::LoadString(hinst, ids, &sz[0], cchMax);
        ::SetWindowText(WindowOf(IDC_BADTRUSTBANTER3), &sz[0]);

        }

    // Position the controls so that all are visible
        {
        UINT spacing = GetSystemMetrics(SM_CYFIXEDFRAME) * 2;
        RECT rc1, rc2, rc3;
        int h;
        POINT pt;

        //
        // Where on the screen is the client area of the dialog?
        //
        pt.x = 0;
//.........这里部分代码省略.........
开发者ID:mingpen,项目名称:OpenNT,代码行数:101,代码来源:uisupp~1.cpp


示例5: OptionsProc

INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{	
	switch(msg) {
	case WM_INITDIALOG:
		{
			int startupmode,exitmode;
			COMBOBOXINFO cbi={0};
			cbi.cbSize = sizeof(cbi);

			opses_count=0;
			g_opHdlg=hdlg;
			bOptionsInit=TRUE;
			TranslateDialogDefault(hdlg);
			hMarked = Skin_GetIconByHandle(iconList[1].hIcolib);
			hNotMarked = Skin_GetIconByHandle(iconList[2].hIcolib);

			hIcon=(bChecked=IsMarkedUserDefSession(opses_count))?hMarked:hNotMarked;

			SetDlgItemInt(hdlg, IDC_TRACK,ses_limit=db_get_b(0, MODNAME, "TrackCount", 10), FALSE);
			SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
			SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, NULL, FALSE));

			SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
			SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODNAME, "StartupModeDelay", 1500), FALSE);
			startupmode = db_get_b(NULL, MODNAME, "StartupMode", 3);
			exitmode = db_get_b(NULL, MODNAME, "ShutdownMode", 2);

			g_bExclHidden = db_get_b(NULL, MODNAME, "ExclHidden", 0);
			g_bWarnOnHidden = db_get_b(NULL, MODNAME, "WarnOnHidden", 0);
			g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1);
			g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0);

			CheckDlgButton(hdlg,IDC_EXCLHIDDEN,g_bExclHidden?BST_CHECKED:BST_UNCHECKED);
			CheckDlgButton(hdlg,IDC_LASTHIDDENWARN,g_bWarnOnHidden?BST_CHECKED:BST_UNCHECKED);
			CheckDlgButton(hdlg,IDC_WARNINGS,g_bOtherWarnings?BST_CHECKED:BST_UNCHECKED);
			CheckDlgButton(hdlg,IDC_CRASHRECOVERY,g_bCrashRecovery?BST_CHECKED:BST_UNCHECKED);


			if (startupmode == 1)
				CheckDlgButton(hdlg,IDC_STARTDIALOG,BST_CHECKED);
			else if (startupmode == 3) {
				CheckDlgButton(hdlg,IDC_STARTDIALOG,BST_CHECKED);
				CheckDlgButton(hdlg,IDC_CHECKLAST,BST_CHECKED);
			}
			else if (startupmode == 2) {
				CheckDlgButton(hdlg,IDC_RLOADLAST,BST_CHECKED);
				EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
			}
			else if (startupmode == 0)	{
				CheckDlgButton(hdlg,IDC_RNOTHING,BST_CHECKED);
				EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), FALSE);
				EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), FALSE);
				EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), FALSE);
				EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
			}

			if (exitmode == 0) {
				CheckDlgButton(hdlg,IDC_REXDSAVE,BST_CHECKED);
				EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_TRACK),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),FALSE);
			}
			else if (exitmode == 1)
				CheckDlgButton(hdlg,IDC_REXASK,BST_CHECKED);
			else if (exitmode == 2)
				CheckDlgButton(hdlg,IDC_REXSAVE,BST_CHECKED);

			LoadSessionToCombobox (hdlg,1,255,"UserSessionDsc",0);
			if (SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0)) {
				EnableWindow(GetDlgItem(hdlg,IDC_EDIT),TRUE);
				SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
				if (!OpLoadSessionContacts(0,opses_count))
					EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
			}

			GetComboBoxInfo(GetDlgItem(hdlg,IDC_LIST),&cbi);
			mir_subclassWindow(cbi.hwndItem, ComboBoxSubclassProc);

			hComboBoxEdit=cbi.hwndItem;
			hComboBox=cbi.hwndCombo;

			SetWindowPos( hComboBoxEdit, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED );

			bOptionsInit=FALSE;
		}
		break;

	case WM_CTLCOLORLISTBOX:
		switch(GetDlgCtrlID((HWND) lparam)) {
		case IDC_OPCLIST:
			SetBkMode((HDC) wparam, TRANSPARENT);
			return (BOOL) CreateSolidBrush(GetSysColor(COLOR_3DFACE));
		}
		break;

	case WM_NOTIFY:
		switch(((LPNMHDR)lparam)->code) {
		case PSN_APPLY:
			{
//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:Options.cpp


示例6: CreatePen

void CUnreadWavesFlyout::PaintBottom(CDC & dc, RECT & rcBounds)
{
	static HPEN hBorderPen = CreatePen(PS_SOLID, 1, RGB(204, 217, 234));
	static HBRUSH hBackgroundBrush = CreateSolidBrush(RGB(241, 245, 251));
	static HFONT hFont = CreateFontIndirectEx(GetMessageBoxFont(), FW_NORMAL, FALSE, TRUE);

	CHECK_HANDLE(hBorderPen);
	CHECK_HANDLE(hBackgroundBrush);
	CHECK_HANDLE(hFont);

	//
	// Draw the background
	//

	RECT rc = rcBounds;

	rc.top = rc.bottom - FL_BOTTOM_HEIGHT;

	HGDIOBJ hOriginal = dc.SelectPen(hBorderPen);

	dc.MoveToEx(rc.left, rc.top, NULL);
	dc.LineTo(rc.right, rc.top);

	dc.SelectObject(hOriginal);

	rc.top += 1;

	dc.FillRect(&rc, hBackgroundBrush);

	dc.SelectObject(hOriginal);

	//
	// Draw the label
	//

	hOriginal = dc.SelectFont(hFont);

	TEXTMETRIC tm;

	dc.GetTextMetrics(&tm);

	rc = rcBounds;
	rc.top = rc.bottom - FL_BOTTOM_HEIGHT + 1;

	INT nOffset = ((rc.bottom - rc.top) - tm.tmHeight) / 2;

	rc.top += nOffset;
	rc.left += nOffset;
	rc.right -= nOffset;

	dc.DrawText(L"Go to Inbox", &rc, DT_CALCRECT | DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);

	dc.SetTextColor(RGB(0, 102, 204));
	dc.SetBkColor(RGB(241, 245, 251));

	dc.DrawText(L"Go to Inbox", &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);

	INT nCount = m_lpWaves->GetChanges().size() - FL_MAXIMUM_WAVES;

	if (nCount > 0)
	{
		wstring szBuffer;

		if (nCount == 1)
		{
			szBuffer = L"1 more unread wave";
		}
		else
		{
			szBuffer = Format(L"%d more unread waves", nCount);
		}

		RECT rc2 = rc;
		rc2.left = rc2.right;
		rc2.right = rcBounds.right - nOffset;

		dc.SetTextColor(GetSysColor(COLOR_BTNTEXT));
		dc.SelectFont(GetMessageBoxFont());

		dc.DrawText(szBuffer, &rc2, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_RIGHT);
	}

	dc.SelectObject(hOriginal);
}
开发者ID:pvginkel,项目名称:wave-notify,代码行数:84,代码来源:CUnreadWavesFlyout.cpp


示例7: paint_text

/* paint text of combobox, needed for read-only drop downs. */
static void paint_text (HWND hwnd, HDC hdc, DWORD dwStyle, const COMBOBOXINFO *cbi)
{
    INT  id, size = 0;
    LPWSTR pText = NULL;
    UINT itemState = ODS_COMBOBOXEDIT;
    HFONT font = (HFONT)SendMessageW (hwnd, WM_GETFONT, 0, 0);
    HFONT hPrevFont = (font) ? SelectObject(hdc, font) : 0;
    RECT rectEdit;
    BOOL focused = GetFocus () == hwnd;
    BOOL dropped = cbi->stateButton == STATE_SYSTEM_PRESSED;

    TRACE("\n");

    /* follow Windows combobox that sends a bunch of text
     * inquiries to its listbox while processing WM_PAINT. */

    if( (id = SendMessageW (cbi->hwndList, LB_GETCURSEL, 0, 0) ) != LB_ERR )
    {
        size = SendMessageW (cbi->hwndList, LB_GETTEXTLEN, id, 0);
        if (size == LB_ERR)
          FIXME("LB_ERR probably not handled yet\n");
        if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) )
        {
            /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
            size = SendMessageW (cbi->hwndList, LB_GETTEXT, id, (LPARAM)pText);
            pText[size] = '\0'; /* just in case */
        } else return;
    }
    else
       if( !(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
           return;

    /*
     * Give ourselves some space.
     */
    CopyRect (&rectEdit, &cbi->rcItem);
    InflateRect( &rectEdit, -1, -1 );
     
    if(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
    {
       DRAWITEMSTRUCT dis;
       HRGN           clipRegion;
       UINT ctlid = (UINT)GetWindowLongPtrW( hwnd, GWLP_ID );

       /* setup state for DRAWITEM message. Owner will highlight */
       if ( focused && !dropped )
           itemState |= ODS_SELECTED | ODS_FOCUS;

       /*
        * Save the current clip region.
        * To retrieve the clip region, we need to create one "dummy"
        * clip region.
        */
       clipRegion = CreateRectRgnIndirect(&rectEdit);

       if (GetClipRgn(hdc, clipRegion)!=1)
       {
         DeleteObject(clipRegion);
         clipRegion=NULL;
       }

       if (!IsWindowEnabled(hwnd)) itemState |= ODS_DISABLED;

       dis.CtlType      = ODT_COMBOBOX;
       dis.CtlID        = ctlid;
       dis.hwndItem     = hwnd;
       dis.itemAction   = ODA_DRAWENTIRE;
       dis.itemID       = id;
       dis.itemState    = itemState;
       dis.hDC          = hdc;
       dis.rcItem       = rectEdit;
       dis.itemData     = SendMessageW(cbi->hwndList, LB_GETITEMDATA, id, 0);

       /*
        * Clip the DC and have the parent draw the item.
        */
       IntersectClipRect(hdc,
                         rectEdit.left,  rectEdit.top,
                         rectEdit.right, rectEdit.bottom);

       SendMessageW(GetParent (hwnd), WM_DRAWITEM, ctlid, (LPARAM)&dis );

       /*
        * Reset the clipping region.
        */
       SelectClipRgn(hdc, clipRegion);
    }
    else
    {
       static const WCHAR empty_stringW[] = { 0 };

       if ( focused && !dropped ) {

           /* highlight */
           FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
           SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
           SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
      }

//.........这里部分代码省略.........
开发者ID:AlexSteel,项目名称:wine,代码行数:101,代码来源:theme_combo.c


示例8: switch

void CVolumeCtrl::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
{
	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);

	LRESULT lr = CDRF_DODEFAULT;

	if(m_fSelfDrawn)
	switch(pNMCD->dwDrawStage)
	{
	case CDDS_PREPAINT:
		lr = CDRF_NOTIFYITEMDRAW;
		break;

	case CDDS_ITEMPREPAINT:
		if(pNMCD->dwItemSpec == TBCD_CHANNEL)
		{
			CDC dc;
			dc.Attach(pNMCD->hdc);

				CRect r;
				GetClientRect(r);
				r.DeflateRect(8, 4, 10, 11);
				CopyRect(&pNMCD->rc, &r);
				CPen shadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
				CPen light(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
				CPen* old = dc.SelectObject(&light);
				dc.MoveTo(pNMCD->rc.right, pNMCD->rc.top);
				dc.LineTo(pNMCD->rc.right, pNMCD->rc.bottom);
				dc.LineTo(pNMCD->rc.left, pNMCD->rc.bottom);
				dc.SelectObject(&shadow);
				dc.LineTo(pNMCD->rc.right, pNMCD->rc.top);
				dc.SelectObject(old);

			dc.Detach();
			lr = CDRF_SKIPDEFAULT;
		}
		else if(pNMCD->dwItemSpec == TBCD_THUMB)
		{
			CDC dc;
			dc.Attach(pNMCD->hdc);
			pNMCD->rc.bottom--;
			CRect r(pNMCD->rc);
			r.DeflateRect(0, 3, 1, 0);
		
				COLORREF shadow = GetSysColor(COLOR_3DSHADOW);
				COLORREF light = GetSysColor(COLOR_3DHILIGHT);
				dc.Draw3dRect(&r, light, 0);
				r.DeflateRect(0, 0, 1, 1);
				dc.Draw3dRect(&r, light, shadow);
				r.DeflateRect(1, 1, 1, 1);
				dc.FillSolidRect(&r, GetSysColor(COLOR_3DFACE));
				dc.SetPixel(r.left+7, r.top-1, GetSysColor(COLOR_3DFACE));
		
			dc.Detach();
			lr = CDRF_SKIPDEFAULT;
		}

		break;
	};

	pNMCD->uItemState &= ~CDIS_FOCUS;

	*pResult = lr;
}
开发者ID:Strongc,项目名称:playasa,代码行数:64,代码来源:VolumeCtrl.cpp


示例9: switch

LRESULT WINAPI SmpEditFrameProc
(
	HWND     hWnd,
	UINT	 message,
	WPARAM   wParam,
	LPARAM   lParam
)
{ // 1
    switch (message) 
	{
		case WM_ERASEBKGND: //2
		{
			HDC hDC = (HDC)wParam;
			HBRUSH hFill;
			RECT rect = {0, 0, 0, 0};
			     
			GetClientRect(hWnd, &rect);
			
			if (hFill = CreateSolidBrush(GetSysColor(COLOR_WINDOW))) //3
			{
				FillRect(hDC, (LPRECT)&rect, hFill);
				DeleteObject(hFill);
			}
			
			break;
		}

		// Nonsense code added for test
		case 0: //4
			if (hWnd) //5 
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			else
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			break;

		// Nonsense code added for test
		case 1: //6
			if (hWnd) //7
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			else
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			break;

		// Nonsense code added for test
		case 2: //8
			if (hWnd) //9
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			else
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			break;

		// Nonsense code added for test
		default:
			if (hWnd) //10
				if (hWnd)
					if (hWnd)
						if (hWnd)
							if (hWnd)
								if (hWnd)
									if (hWnd)
										if (hWnd)
											if (hWnd)
												if (hWnd)
													if (hWnd) // 20
														if (hWnd) 
															if (hWnd) //22
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			else
			{
				MessageBox (hWnd,"","",MB_OK);
			}
			break;
	}
	
	return DefWindowProc(hWnd, message, wParam, lParam);
}
开发者ID:Tallmaris,项目名称:ccm,代码行数:90,代码来源:valian.c


示例10: winButtonDrawImageText

static void winButtonDrawImageText(Ihandle* ih, HDC hDC, int rect_width, int rect_height, int border, UINT itemState)
{
  int xpad = ih->data->horiz_padding + border, 
      ypad = ih->data->vert_padding + border;
  int x, y, width, height, 
      txt_x, txt_y, txt_width, txt_height, 
      img_x, img_y, img_width, img_height, 
      bpp, shift = 0, style = 0;
  HFONT hFont = (HFONT)iupwinGetHFontAttrib(ih);
  HBITMAP hBitmap, hMask;
  COLORREF fgcolor;

  char* title = iupAttribGet(ih, "TITLE");
  char* str = iupStrProcessMnemonic(title, NULL, 0);   /* remove & */
  iupdrvFontGetMultiLineStringSize(ih, str, &txt_width, &txt_height);
  if (str && str!=title) free(str);

  if (itemState & ODS_DISABLED)
    fgcolor = GetSysColor(COLOR_GRAYTEXT);
  else
    fgcolor = ih->data->fgcolor;

  hBitmap = winButtonGetBitmap(ih, itemState, NULL, &img_width, &img_height, &bpp, &hMask);
  if (!hBitmap)
    return;

  if (ih->data->img_position == IUP_IMGPOS_RIGHT ||
      ih->data->img_position == IUP_IMGPOS_LEFT)
  {
    width  = img_width + txt_width + ih->data->spacing;
    height = iupMAX(img_height, txt_height);
  }
  else
  {
    width = iupMAX(img_width, txt_width);
    height = img_height + txt_height + ih->data->spacing;
  }

  if (itemState & ODS_SELECTED && !iupwin_comctl32ver6)
    shift = 1;

  if (itemState & ODS_NOACCEL && !iupwinGetKeyBoardCues())
    style |= DT_HIDEPREFIX;

  x = winButtonCalcAlignPosX(ih->data->horiz_alignment, rect_width, width, xpad, shift);
  y = winButtonCalcAlignPosY(ih->data->vert_alignment, rect_height, height, ypad, shift);

  switch(ih->data->img_position)
  {
  case IUP_IMGPOS_TOP:
    img_y = y;
    txt_y = y + img_height + ih->data->spacing;
    if (img_width > txt_width)
    {
      img_x = x;
      txt_x = x + (img_width-txt_width)/2;
    }
    else
    {
      img_x = x + (txt_width-img_width)/2;
      txt_x = x;
    }
    break;
  case IUP_IMGPOS_BOTTOM:
    img_y = y + txt_height + ih->data->spacing;
    txt_y = y;
    if (img_width > txt_width)
    {
      img_x = x;
      txt_x = x + (img_width-txt_width)/2;
    }
    else
    {
      img_x = x + (txt_width-img_width)/2;
      txt_x = x;
    }
    break;
  case IUP_IMGPOS_RIGHT:
    img_x = x + txt_width + ih->data->spacing;
    txt_x = x;
    if (img_height > txt_height)
    {
      img_y = y;
      txt_y = y + (img_height-txt_height)/2;
    }
    else
    {
      img_y = y + (txt_height-img_height)/2;
      txt_y = y;
    }
    break;
  default: /* IUP_IMGPOS_LEFT */
    img_x = x;
    txt_x = x + img_width + ih->data->spacing;
    if (img_height > txt_height)
    {
      img_y = y;
      txt_y = y + (img_height-txt_height)/2;
    }
    else
//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:iup-iup,代码行数:101,代码来源:iupwin_button.c


示例11: OptionsDlgProc

static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	OptionsPageData *opd;
	OptionsDlgData *dat = (OptionsDlgData*)GetWindowLongPtr(hdlg, GWLP_USERDATA);
	HWND hwndTree = GetDlgItem(hdlg, IDC_PAGETREE);

	switch (message) {
	case WM_CTLCOLORSTATIC:
		switch (GetDlgCtrlID((HWND)lParam)) {
		case IDC_WHITERECT:
		case IDC_KEYWORD_FILTER:
			SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
			return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
		}
		break;

	case WM_INITDIALOG:
		TranslateDialogDefault(hdlg);

		if (!ServiceExists(MS_MODERNOPT_SHOW))
			ShowWindow(GetDlgItem(hdlg, IDC_MODERN), FALSE);

		dat = new OptionsDlgData;
		SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)dat);

		Utils_RestoreWindowPositionNoSize(hdlg, NULL, "Options", "");
		Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS);
		EnableWindow(GetDlgItem(hdlg, IDC_APPLY), FALSE);
		{
			COMBOBOXINFO cbi;
			cbi.cbSize = sizeof(COMBOBOXINFO);
			GetComboBoxInfo(GetDlgItem(hdlg, IDC_KEYWORD_FILTER), &cbi);
			mir_subclassWindow(cbi.hwndItem, OptionsFilterSubclassProc);

			if (IsAeroMode()) {
				mir_subclassWindow(cbi.hwndCombo, AeroPaintSubclassProc);
				mir_subclassWindow(cbi.hwndItem, AeroPaintSubclassProc);
			}

			PROPSHEETHEADER *psh = (PROPSHEETHEADER*)lParam;
			SetWindowText(hdlg, psh->pszCaption);

			LOGFONT lf;
			dat->hBoldFont = (HFONT)SendDlgItemMessage(hdlg, IDC_APPLY, WM_GETFONT, 0, 0);
			GetObject(dat->hBoldFont, sizeof(lf), &lf);
			lf.lfWeight = FW_BOLD;
			dat->hBoldFont = CreateFontIndirect(&lf);

			dat->hPluginLoad = HookEventMessage(ME_SYSTEM_MODULELOAD, hdlg, HM_MODULELOAD);
			dat->hPluginUnload = HookEventMessage(ME_SYSTEM_MODULEUNLOAD, hdlg, HM_MODULEUNLOAD);
			dat->currentPage = -1;

			ptrT lastPage, lastGroup, lastTab;
			OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)psh->pStartPage;
			if (ood->pszPage == NULL) {
				lastPage = db_get_tsa(NULL, "Options", "LastPage");

				if (ood->pszGroup == NULL)
					lastGroup = db_get_tsa(NULL, "Options", "LastGroup");
				else
					lastGroup = mir_a2t(ood->pszGroup);
			}
			else {
				lastPage = mir_a2t(ood->pszPage);
				lastGroup = mir_a2t(ood->pszGroup);
			}

			if (ood->pszTab == NULL)
				lastTab = db_get_tsa(NULL, "Options", "LastTab");
			else
				lastTab = mir_a2t(ood->pszTab);

			OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
			for (UINT i = 0; i < psh->nPages; i++, odp++) {
				opd = new OptionsPageData(odp);
				if (opd->pDialog == NULL) // smth went wrong
					delete opd;
				else
					dat->arOpd.insert(opd);

				if (!mir_tstrcmp(lastPage, odp->ptszTitle) && !mir_tstrcmp(lastGroup, odp->ptszGroup))
					if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_tstrcmp(lastTab, odp->ptszTab))
						dat->currentPage = (int)i;
			}

			GetWindowRect(GetDlgItem(hdlg, IDC_STNOPAGE), &dat->rcDisplay);
			MapWindowPoints(NULL, hdlg, (LPPOINT)&dat->rcDisplay, 2);

			// Add an item to count in height
			TCITEM tie;
			tie.mask = TCIF_TEXT | TCIF_IMAGE;
			tie.iImage = -1;
			tie.pszText = _T("X");
			TabCtrl_InsertItem(GetDlgItem(hdlg, IDC_TAB), 0, &tie);

			GetWindowRect(GetDlgItem(hdlg, IDC_TAB), &dat->rcTab);
			MapWindowPoints(NULL, hdlg, (LPPOINT)&dat->rcTab, 2);
			TabCtrl_AdjustRect(GetDlgItem(hdlg, IDC_TAB), FALSE, &dat->rcTab);

			FillFilterCombo(hdlg, dat);
//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,代码来源:options.cpp


示例12: OptionsFilterSubclassProc

static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	if (message != WM_PAINT && message != WM_PRINT)
		return mir_callNextSubclass(hWnd, OptionsFilterSubclassProc, message, wParam, lParam);

	if (GetFocus() == hWnd || GetWindowTextLength(hWnd))
		return mir_callNextSubclass(hWnd, OptionsFilterSubclassProc, message, wParam, lParam);

	RECT rc;
	GetClientRect(hWnd, &rc);

	PAINTSTRUCT paint;
	HDC hdc = (message == WM_PAINT) ? BeginPaint(hWnd, &paint) : (HDC)wParam;

	TCHAR buf[255];
	if (bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0)
		mir_sntprintf(buf, TranslateT("Loading... %d%%"), FilterLoadProgress);
	else
		mir_sntprintf(buf, TranslateT("Search"));

	bool bDrawnByTheme = false;

	int oldMode = SetBkMode(hdc, TRANSPARENT);

	HTHEME hTheme = OpenThemeData(hWnd, L"EDIT");
	if (hTheme) {
		if (IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
			DrawThemeParentBackground(hWnd, hdc, &rc);

		RECT rc2;
		GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc, &rc2);
		rc2.top = 2 * rc.top - rc2.top;
		rc2.left = 2 * rc.left - rc2.left;
		rc2.bottom = 2 * rc.bottom - rc2.bottom;
		rc2.right = 2 * rc.right - rc2.right;

		DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc2, &rc);
		HFONT hFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
		HFONT oldFont = (HFONT)SelectObject(hdc, hFont);

		wchar_t *bufW = mir_t2u(buf);
		DrawThemeText(hTheme, hdc, EP_EDITTEXT, ETS_DISABLED, bufW, -1, 0, 0, &rc);
		mir_free(bufW);

		SelectObject(hdc, oldFont);
		CloseThemeData(hTheme);
		bDrawnByTheme = true;
	}

	SetBkMode(hdc, oldMode);

	if (!bDrawnByTheme) {
		HFONT hFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
		HFONT oldFont = (HFONT)SelectObject(hdc, hFont);
		SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
		FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
		oldMode = SetBkMode(hdc, TRANSPARENT);
		DrawText(hdc, buf, -1, &rc, 0);
		SetBkMode(hdc, oldMode);
		SelectObject(hdc, oldFont);
	}

	if (message == WM_PAINT)
		EndPaint(hWnd, &paint);

	return 0;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:67,代码来源:options.cpp


示例13: dc

//--------------------------------------------------------------------------//
//--------------------------------------------------------------------------//
LRESULT CCtlPanel::OnDrawItem (UINT /*uMsg*/, WPARAM wParam,
							   LPARAM lParam, BOOL &bHandled)
{
	UINT idCtl = wParam;
	LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) lParam;

	if (idCtl == IDC_COLOR)
	{
		CAGDC dc (lpdis->hDC);
		HBRUSH hbr = (HBRUSH) GetStockObject (WHITE_BRUSH);
		FillRect (lpdis->hDC, &lpdis->rcItem, hbr);

		if ((int) lpdis->itemID != -1)
		{
			COLORREF clr = (COLORREF) ::SendMessage (lpdis->hwndItem,
			  CB_GETITEMDATA, lpdis->itemID, 0);

			RECT rect = lpdis->rcItem;
			InflateRect (&rect, -4, -2);
			hbr = CreateSolidBrush (clr | PALETTERGB_FLAG);
			FillRect (lpdis->hDC, &rect, hbr);
			DeleteObject (hbr);
			hbr = (HBRUSH) GetStockObject (BLACK_BRUSH);
			FrameRect (lpdis->hDC, &rect, hbr);
		}

		if (lpdis->itemState & ODS_FOCUS || lpdis->itemState & ODS_SELECTED)
		{
			hbr = (HBRUSH) GetStockObject (BLACK_BRUSH);
			FrameRect (lpdis->hDC, &lpdis->rcItem, hbr);
		}
	}
	else if (idCtl == IDC_FONT)
	{
		if ((int) lpdis->itemID != -1)
		{
			int nFont = ::SendMessage (lpdis->hwndItem, CB_GETITEMDATA, lpdis->itemID, 0);

			FONTARRAY &FontArray = GetFontArray ();
			LOGFONT NewFont = FontArray[nFont].lf;
			NewFont.lfHeight = m_nFontHeight;
			NewFont.lfWidth = 0;
			if (NewFont.lfCharSet == SYMBOL_CHARSET)
			{
				lstrcpy (NewFont.lfFaceName, "Arial");
				NewFont.lfCharSet = ANSI_CHARSET;
				NewFont.lfPitchAndFamily = FF_SWISS;
			}

			SaveDC (lpdis->hDC);
			SetTextAlign (lpdis->hDC, TA_LEFT | TA_TOP | TA_NOUPDATECP);

			if (lpdis->itemState & ODS_SELECTED)
				SetTextColor (lpdis->hDC, GetSysColor (COLOR_HIGHLIGHTTEXT));
			else
				SetTextColor (lpdis->hDC, GetSysColor (COLOR_WINDOWTEXT));

			if (lpdis->itemState & ODS_SELECTED)
				SetBkColor (lpdis->hDC, GetSysColor (COLOR_HIGHLIGHT));
			else
				SetBkColor (lpdis->hDC, GetSysColor (COLOR_WINDOW));

			HFONT hFont = CreateFontIndirect (&NewFont);
			HFONT hOldFont = (HFONT) SelectObject (lpdis->hDC, hFont);
			ExtTextOut (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
				ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem,
				FontArray[nFont].szFullName,
				lstrlen (FontArray[nFont].szFullName), NULL);
  
			if (lpdis->itemState & ODS_FOCUS)
				DrawFocusRect (lpdis->hDC, &lpdis->rcItem);

			SelectObject (lpdis->hDC, hOldFont);
			DeleteObject (hFont);
			RestoreDC (lpdis->hDC, -1);
		}
	}

	bHandled = TRUE;
	return (TRUE);
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:83,代码来源:CtlPanel.cpp


示例14: Drawtabs

void CContainer::Drawtabs(CGDI* dc)
{
	CPen light;
	CPen Dark;
	CPen Black;	
	CPen Face;

	if ( m_Numtabs <= 1 && m_alnTab==ALN_BOTTOM) return;
	light.CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNHIGHLIGHT));
	Dark.CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW));
	Black.CreatePen(PS_SOLID,1,GetSysColor(BLACK_PEN));	
	Face.CreatePen(PS_SOLID,1,CDrawLayer::GetRGBColorFace());	
	CRect rectText;
	HFONT hFONT= dc->SelectObject(CFont((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
	CPen oldPen= dc->SelectObject(&Dark);
	LPCSTR szStrPoints=_T("...");
	for (int iCont=0; iCont< m_Numtabs;iCont++)
	{
		CTab* ct=(CTab*) m_pArray[iCont];
		if (iCont ==m_iSelectTab)
		{
			CGradient M(CSize(ct->rect.Width(),ct->rect.Height()+1));	
			M.PrepareTabs(dc,CDrawLayer::GetRGBColorWhite(),CDrawLayer::GetRGBColorWhite());
			M.Draw(dc,ct->rect.left,ct->rect.top,0,0,ct->rect.Width(),ct->rect.Height(),SRCCOPY);
			dc->SelectObject(&Dark);
		
			dc->MoveTo(ct->rect.left,ct->rect.top);
			dc->LineTo(ct->rect.left,ct->rect.bottom-2);
			dc->MoveTo(ct->rect.left+1,ct->rect.bottom-2);
			dc->LineTo(ct->rect.left+2,ct->rect.bottom-1);
			
			//corner left corrections begin
			dc->SelectObject(&Face);
			dc->MoveTo(ct->rect.left,ct->rect.bottom-2);
			dc->LineTo(ct->rect.left,ct->rect.bottom-1);

			dc->MoveTo(ct->rect.left,ct->rect.bottom-1);
			dc->LineTo(ct->rect.left+2,ct->rect.bottom-1);
			//---corner corrections end
			
			dc->SelectObject(&Dark);
			dc->MoveTo(m_rectTab.left,ct->rect.top);
			dc->LineTo(ct->rect.left,ct->rect.top);

			dc->MoveTo(ct->rect.right,ct->rect.top);
			dc->LineTo(m_rectTab.right,ct->rect.top);

			//line bottom
			dc->SelectObject(&Dark);
			dc->MoveTo(ct->rect.left+2,ct->rect.bottom-1);
			dc->LineTo(ct->rect.right-3,ct->rect.bottom-1);
			
			dc->SelectObject(&Face);
			dc->MoveTo(ct->rect.left+2,ct->rect.bottom-2);
			dc->LineTo(ct->rect.right-3,ct->rect.bottom-2);

			//right corner
			dc->SelectObject(&Dark);
			dc->MoveTo(ct->rect.right-3,ct->rect.bottom-1);
			dc->LineTo(ct->rect.right,ct->rect.bottom-4);

			dc->SelectObject(&Face);
			dc->MoveTo(ct->rect.right-3,ct->rect.bottom-2);
			dc->LineTo(ct->rect.right-1,ct->rect.bottom-5);
			
			// corner right corrections
			dc->MoveTo(ct->rect.right-1,ct->rect.bottom-2);
			dc->LineTo(ct->rect.right,ct->rect.bottom-2);
			dc->MoveTo(ct->rect.right-2,ct->rect.bottom-1);
			dc->LineTo(ct->rect.right,ct->rect.bottom-1);

			// end corner right corrections


			//right vertical line
			dc->SelectObject(&Dark);
			dc->MoveTo(ct->rect.right-1,ct->rect.top);
			dc->LineTo(ct->rect.right-1,ct->rect.bottom-3);
			
			dc->SelectObject(&Face);
			dc->MoveTo(ct->rect.right-2,ct->rect.top+1);
			dc->LineTo(ct->rect.right-2,ct->rect.bottom-3);
		
		
		}
		else
		{
			if(iCont !=0 && ((iCont-1)!= m_iSelectTab))
			{
				dc->SelectObject(&Dark);
				dc->MoveTo(ct->rect.left,ct->rect.top+3);
				dc->LineTo(ct->rect.left,ct->rect.bottom-3);
			}
		}
	
		//se dibuja el icono
		int nMode = dc->SetBkMode(TRANSPARENT);
		CSize m_sChar=dc->GetTextExtent(ct->lpMsg,strlen(ct->lpMsg));
		COLORREF clrtext=RGB(0,0,0);
		if (iCont !=m_iSelectTab)
//.........这里部分代码省略.........
开发者ID:axxapp,项目名称:winxgui,代码行数:101,代码来源:CContainer.cpp


示例15: MoveWindow

void COptionTreeItemDate::DrawAttribute(CDC *pDC, const RECT &rcRect)
{
	// If we don't have focus, text is drawn.
	if (m_bFocus == TRUE)
	{
		return;
	}

	// Make sure options aren't NULL
	if (m_otOption == NULL)
	{
		return;
	}

	// Make sure there is a window
	if (!IsWindow(GetSafeHwnd()))
	{
		return;
	}

	// Set window position
	if (IsWindow(GetSafeHwnd()))
	{
		MoveWindow(m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height());
	}

	// Declare variables
	HGDIOBJ hOld;
	COLORREF crOld;
	int nOldBack;
	CRect rcText;
	CString strText;
	COLORREF crOldBack;

	// Select font
	hOld = pDC->SelectObject(m_otOption->GetNormalFont());
	
	// Set text color
	if (IsReadOnly() == TRUE || m_otOption->IsWindowEnabled() == FALSE)
	{
		crOld = pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));
	}
	else
	{
		crOld = pDC->SetTextColor(GetTextColor());
	}

	// Set background mode
	nOldBack = pDC->SetBkMode(TRANSPARENT);

	// Set background color
	crOldBack = pDC->SetBkColor(GetBackgroundColor());	

	// Get rectangle
	rcText = rcRect;

	// Get text
	GetWindowText(strText);

	// Draw text
	pDC->DrawText(strText, rcText, DT_SINGLELINE | DT_VCENTER);

	// Restore GDI ojects
	pDC->SelectObject(hOld);
	pDC->SetTextColor(crOld);
	pDC->SetBkMode(nOldBack);
	pDC->SetBkColor(crOldBack);

}
开发者ID:ngphloc,项目名称:agmagic,代码行数:69,代码来源:OptionTreeItemDate.cpp


示例16: DownloadProgressProc

LRESULT CALLBACK
DownloadProgressProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
    static WCHAR szProgressText[MAX_STR_LEN] = {0};

    switch (uMsg)
    {
        case WM_SETTEXT:
        {
            if (lParam)
            {
                StringCbCopyW(szProgressText,
                              sizeof(szProgressText),
                              (PCWSTR)lParam);
            }
            return TRUE;
        }

        case WM_ERASEBKGND:
        case WM_PAINT:
        {
            PAINTSTRUCT  ps;
            HDC hDC = BeginPaint(hWnd, &ps), hdcMem;
            HBITMAP hbmMem;
            HANDLE hOld;
            RECT myRect;
            UINT win_width, win_height;

            GetClientRect(hWnd, &myRect);

            /* grab the progress bar rect size */
            win_width  = myRect.right - myRect.left;
            win_height = myRect.bottom - myRect.top;

            /* create an off-screen DC for double-buffering */
            hdcMem = CreateCompatibleDC(hDC);
            hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);

            hOld = SelectObject(hdcMem, hbmMem);

            /* call the original draw code and redirect it to our memory buffer */
            DefSubclassProc(hWnd, uMsg, (WPARAM)hdcMem, lParam);

            /* draw our nifty progress text over it */
            SelectFont(hdcMem, GetStockFont(DEFAULT_GUI_FONT));
            DrawShadowText(hdcMem, szProgressText, wcslen(szProgressText),
                           &myRect,
                           DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE,
                           GetSysColor(COLOR_CAPTIONTEXT),
                           GetSysColor(COLOR_3DSHADOW),
                           1, 1);

            /* transfer the off-screen DC to the screen */
            BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);

            /* free the off-screen DC */
            SelectObject(hdcMem, hOld);
            DeleteObject(hbmMem);
            DeleteDC(hdcMem);

            EndPaint(hWnd, &ps);
            return 0;
        }

        /* Raymond Chen says that we should safely unsubclass all the things!
          (http://blogs.msdn.com/b/oldnewthing/archive/2003/11/11/55653.aspx) */
        case WM_NCDESTROY:
        {
            ZeroMemory(szProgressText, sizeof( 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetSystem函数代码示例发布时间:2022-05-30
下一篇:
C++ GetSummoner函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap