您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DrawThemeBackground函数代码示例

51自学网 2021-06-01 20:30:16
  C++
这篇教程C++ DrawThemeBackground函数代码示例写得很实用,希望能帮到您。

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

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

示例1: paint

/* paint the combobox */static LRESULT paint (HTHEME theme, HWND hwnd, HDC hParamDC, ULONG state){  PAINTSTRUCT ps;  HDC   hDC;  COMBOBOXINFO cbi;  DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);  hDC = (hParamDC) ? hParamDC                   : BeginPaint( hwnd, &ps);  TRACE("hdc=%p/n", hDC);  if( hDC && !(state & STATE_NOREDRAW) )  {      RECT frameRect;      int buttonState;        cbi.cbSize = sizeof (cbi);      SendMessageW (hwnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbi);            /* paint border */      if ((dwStyle & CBS_DROPDOWNLIST) != CBS_SIMPLE)          GetClientRect (hwnd, &frameRect);      else      {          CopyRect (&frameRect, &cbi.rcItem);          InflateRect(&frameRect,               EDIT_CONTROL_PADDING + COMBO_XBORDERSIZE,               EDIT_CONTROL_PADDING + COMBO_YBORDERSIZE);      }            DrawThemeBackground (theme, hDC, 0,           IsWindowEnabled (hwnd) ? CBXS_NORMAL : CBXS_DISABLED, &frameRect, NULL);            /* paint button */      if (cbi.stateButton != STATE_SYSTEM_INVISIBLE)      {          if (!IsWindowEnabled (hwnd))              buttonState = CBXS_DISABLED;          else if (cbi.stateButton == STATE_SYSTEM_PRESSED)              buttonState = CBXS_PRESSED;          else if (state & STATE_HOT)              buttonState = CBXS_HOT;          else              buttonState = CBXS_NORMAL;          DrawThemeBackground (theme, hDC, CP_DROPDOWNBUTTON, buttonState,               &cbi.rcButton, NULL);      }      /* paint text, if we need to */      if ((dwStyle & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)          paint_text (hwnd, hDC, dwStyle, &cbi);  }  if( !hParamDC )    EndPaint(hwnd, &ps);  return 0;}
开发者ID:hoangduit,项目名称:reactos,代码行数:61,


示例2: UPDOWN_Draw

/*********************************************************************** * UPDOWN_Draw * * Draw the arrows. The background need not be erased. */static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc){    BOOL uPressed, uHot, dPressed, dHot;    RECT rect;    HTHEME theme = GetWindowTheme (infoPtr->Self);    int uPart = 0, uState = 0, dPart = 0, dState = 0;    BOOL needBuddyBg = FALSE;    uPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR);    uHot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN);    dPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR);    dHot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN);    if (theme) {        uPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_UPHORZ : SPNP_UP;        uState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED             : (uPressed ? DNS_PRESSED : (uHot ? DNS_HOT : DNS_NORMAL));        dPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_DOWNHORZ : SPNP_DOWN;        dState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED             : (dPressed ? DNS_PRESSED : (dHot ? DNS_HOT : DNS_NORMAL));        needBuddyBg = IsWindow (infoPtr->Buddy)            && (IsThemeBackgroundPartiallyTransparent (theme, uPart, uState)              || IsThemeBackgroundPartiallyTransparent (theme, dPart, dState));    }    /* Draw the common border between ourselves and our buddy */    if (UPDOWN_HasBuddyBorder(infoPtr) || needBuddyBg) {        if (!theme || !UPDOWN_DrawBuddyBackground (infoPtr, hdc)) {            GetClientRect(infoPtr->Self, &rect);	    DrawEdge(hdc, &rect, EDGE_SUNKEN,		     BF_BOTTOM | BF_TOP |		     (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT));        }    }    /* Draw the incr button */    UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR);    if (theme) {        DrawThemeBackground(theme, hdc, uPart, uState, &rect, NULL);    } else {        DrawFrameControl(hdc, &rect, DFC_SCROLL,            (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) |            ((infoPtr->dwStyle & UDS_HOTTRACK) && uHot ? DFCS_HOT : 0) |            (uPressed ? DFCS_PUSHED : 0) |            (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );    }    /* Draw the decr button */    UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR);    if (theme) {        DrawThemeBackground(theme, hdc, dPart, dState, &rect, NULL);    } else {        DrawFrameControl(hdc, &rect, DFC_SCROLL,            (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) |            ((infoPtr->dwStyle & UDS_HOTTRACK) && dHot ? DFCS_HOT : 0) |            (dPressed ? DFCS_PUSHED : 0) |            (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );    }    return 0;}
开发者ID:devyn,项目名称:wine,代码行数:65,


示例3: STATUSBAR_RefreshPart

static voidSTATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID){    HBRUSH hbrBk;    HTHEME theme;    TRACE("item %d/n", itemID);    if (part->bound.right < part->bound.left) return;    if (!RectVisible(hdc, &part->bound))        return;    if ((theme = GetWindowTheme (infoPtr->Self)))    {        RECT cr;        GetClientRect (infoPtr->Self, &cr);        DrawThemeBackground(theme, hdc, 0, 0, &cr, &part->bound);    }    else    {        if (infoPtr->clrBk != CLR_DEFAULT)                hbrBk = CreateSolidBrush (infoPtr->clrBk);        else                hbrBk = GetSysColorBrush (COLOR_3DFACE);        FillRect(hdc, &part->bound, hbrBk);        if (infoPtr->clrBk != CLR_DEFAULT)                DeleteObject (hbrBk);    }    STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);}
开发者ID:ccpgames,项目名称:wine,代码行数:32,


示例4: OpenThemeData

void CToolBarTreeView::Draw(){	const int& cx = m_mdc.cx;	const int& cy = m_mdc.cy;	if (IsAppThemed())	{		HTHEME hTheme = OpenThemeData(m_hWnd, L"TREEVIEW");		ASSERT(hTheme);		RECT rc = {0, 0, cx, cy};		DrawThemeBackground(hTheme, m_mdc, LBCP_BORDER_NOSCROLL, LBPSN_NORMAL, &rc, NULL);		CloseThemeData(hTheme);		// TODO: detect size of border (check for high DPI)		DrawRect(m_mdc, 1, 1, cx - 2, SCY(24), GetSysColor(COLOR_BTNFACE), 96);		DrawRect(m_mdc, 1, 1 + SCY(24) - 1, cx - 2, 1, GetSysColor(COLOR_BTNFACE), 192);	}	else	{		RECT rc = {0, 0, cx, cy};		FillSolidRect(m_mdc, &rc, GetSysColor(COLOR_WINDOW));		FillSolidRect(m_mdc, 1, 1, cx - 2, SCY(24), GetSysColor(COLOR_BTNFACE));		DrawEdge(m_mdc, &rc, EDGE_SUNKEN, BF_RECT);	}}
开发者ID:anlarke,项目名称:MovieExplorer,代码行数:25,


示例5: GB_draw

static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused){    static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };    RECT bgRect, textRect, contentRect;    int state = states[ drawState ];    WCHAR *text = get_button_text(hwnd);    LOGFONTW lf;    HFONT font, hPrevFont = NULL;    BOOL created_font = FALSE;    HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);    if (SUCCEEDED(hr)) {        font = CreateFontIndirectW(&lf);        if (!font)            TRACE("Failed to create font/n");        else {            hPrevFont = SelectObject(hDC, font);            created_font = TRUE;        }    } else {        font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);        hPrevFont = SelectObject(hDC, font);    }    GetClientRect(hwnd, &bgRect);    textRect = bgRect;    if (text)    {        SIZE textExtent;        GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);        bgRect.top += (textExtent.cy / 2);        textRect.left += 10;        textRect.bottom = textRect.top + textExtent.cy;        textRect.right = textRect.left + textExtent.cx + 4;        ExcludeClipRect(hDC, textRect.left, textRect.top, textRect.right, textRect.bottom);    }    GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);    ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);    if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))        DrawThemeParentBackground(hwnd, hDC, NULL);    DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);    SelectClipRgn(hDC, NULL);    if (text)    {        InflateRect(&textRect, -2, 0);        DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);        HeapFree(GetProcessHeap(), 0, text);    }    if (created_font) DeleteObject(font);    if (hPrevFont) SelectObject(hDC, hPrevFont);}
开发者ID:elppans,项目名称:wine-staging-1.9.15_IndexVertexBlending-1.9.11,代码行数:59,


示例6: themeImage

static void themeImage(HDC dc, RECT *r, int cbState, HTHEME theme){	HRESULT res;	res = DrawThemeBackground(theme, dc, BP_CHECKBOX, themestates[cbState], r, NULL);	if (res != S_OK)		xpanichresult("error drawing checkbox image", res);}
开发者ID:graibn,项目名称:ui,代码行数:8,


示例7: xpt_DrawThemeBackground

HRESULT	xpt_DrawThemeBackground(XPTHANDLE xptHandle, HDC hdc, int type, int state, const RECT *sizeRect, const RECT *clipRect){	mir_cslock lck(xptCS);	if (xpt_IsThemed(xptHandle))		return DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect);	return S_FALSE;}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:8,


示例8: STATUSBAR_DrawSizeGrip

static voidSTATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect){    HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen;    POINT pt;    INT i;    TRACE("draw size grip %s/n", wine_dbgstr_rect(lpRect));    if (theme)    {        RECT gripperRect;        SIZE gripperSize;        gripperRect = *lpRect;        if (SUCCEEDED (GetThemePartSize (theme, hdc, SP_GRIPPER, 0, lpRect,             TS_DRAW, &gripperSize)))        {            gripperRect.left = gripperRect.right - gripperSize.cx;            gripperRect.top = gripperRect.bottom - gripperSize.cy;            if (SUCCEEDED (DrawThemeBackground(theme, hdc, SP_GRIPPER, 0, &gripperRect, NULL)))                return;        }    }    pt.x = lpRect->right - 1;    pt.y = lpRect->bottom - 1;    hPenFace = CreatePen( PS_SOLID, 1, comctl32_color.clr3dFace);    hOldPen = SelectObject( hdc, hPenFace );    MoveToEx (hdc, pt.x - 12, pt.y, NULL);    LineTo (hdc, pt.x, pt.y);    LineTo (hdc, pt.x, pt.y - 13);    pt.x--;    pt.y--;    hPenShadow = CreatePen( PS_SOLID, 1, comctl32_color.clr3dShadow);    SelectObject( hdc, hPenShadow );    for (i = 1; i < 11; i += 4) {	MoveToEx (hdc, pt.x - i, pt.y, NULL);	LineTo (hdc, pt.x + 1, pt.y - i - 1);	MoveToEx (hdc, pt.x - i - 1, pt.y, NULL);	LineTo (hdc, pt.x + 1, pt.y - i - 2);    }    hPenHighlight = CreatePen( PS_SOLID, 1, comctl32_color.clr3dHilight);    SelectObject( hdc, hPenHighlight );    for (i = 3; i < 13; i += 4) {	MoveToEx (hdc, pt.x - i, pt.y, NULL);	LineTo (hdc, pt.x + 1, pt.y - i - 1);    }    SelectObject (hdc, hOldPen);    DeleteObject( hPenFace );    DeleteObject( hPenShadow );    DeleteObject( hPenHighlight );}
开发者ID:RPG-7,项目名称:reactos,代码行数:58,


示例9: xpt_DrawThemeBackground

HRESULT	xpt_DrawThemeBackground(XPTHANDLE xptHandle, HDC hdc, int type, int state, const RECT *sizeRect, const RECT *clipRect){    HRESULT res = S_FALSE;    xptlock();    if (xpt_IsThemed(xptHandle))        res = DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect);    xptunlock();    return res;}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:9,


示例10: GetClientRect

void LTIndefProgressBar::VerifyBuffers( CDC* pDC ){	CRect rClientEx;	GetClientRect(rClientEx);	if (!p_BarBack)	{		p_BarBack = LTBitmapBuffer::Create(pDC, rClientEx.Width(),rClientEx.Height());		DrawThemeBackground(h_ThemeBar, p_BarBack->GetDC()->m_hDC, PP_BAR, 0, rClientEx, rClientEx);	}	if (!p_BarSlot)	{		CRect rSlot = rClientEx;		rSlot.right = rSlot.left + SLOT_WIDTH;		p_BarSlot = LTBitmapBuffer::Create(pDC, rSlot.Width(), rClientEx.Height());		DrawThemeBackground(h_ThemeBar, p_BarSlot->GetDC()->m_hDC, PP_FILL, PBFS_PARTIAL, rSlot, rSlot);	}}
开发者ID:sudanthaa,项目名称:LogTool,代码行数:20,


示例11: DrawThemeBackground

//**************************************************************************************************void LTThemeButton::OnPaintButtonState( CDC* pDC ){	if (!p_Owner->PaintBack(this, pDC, r_Area))	{		if (pi_BackColor)			pDC->FillSolidRect(r_Area, *pi_BackColor);	}	DrawThemeBackground(*ph_Theme, pDC->m_hDC, i_Part, i_State + i_StateOffset, r_Area, *pr_Clip);	//LTVirtualButton::OnPaintButtonState(pDC);}
开发者ID:sudanthaa,项目名称:LogTool,代码行数:12,


示例12: SCROLL_ThemeDrawPart

static void SCROLL_ThemeDrawPart(PDRAW_CONTEXT pcontext, int iPartId,int iStateId,  SCROLLBARINFO* psbi, int htCurrent, int htDown, int htHot, RECT* r){    if(psbi->rgstate[htCurrent] & STATE_SYSTEM_UNAVAILABLE)        iStateId += BUTTON_DISABLED - BUTTON_NORMAL;    else if (htHot == htCurrent)        iStateId += BUTTON_HOT - BUTTON_NORMAL;    else if (htDown == htCurrent)        iStateId += BUTTON_PRESSED - BUTTON_NORMAL;    DrawThemeBackground(pcontext->scrolltheme, pcontext->hDC, iPartId, iStateId, r, NULL);}
开发者ID:darkvaderXD2014,项目名称:reactos,代码行数:11,


示例13: UPDOWN_DrawBuddyBackground

/*********************************************************************** * UPDOWN_DrawBuddyBackground * * Draw buddy background for visual integration. */static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc){    RECT br;    HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);    if (!buddyTheme) return FALSE;    GetClientRect (infoPtr->Buddy, &br);    MapWindowPoints (infoPtr->Buddy, infoPtr->Self, (POINT*)&br, 2);    /* FIXME: take disabled etc. into account */    DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL);    return TRUE;}
开发者ID:devyn,项目名称:wine,代码行数:17,


示例14: STATUSBAR_DrawPart

static voidSTATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID){    RECT r = part->bound;    UINT border = BDR_SUNKENOUTER;    HTHEME theme = GetWindowTheme (infoPtr->Self);    int themePart = SP_PANE;    int x = 0;    TRACE("part bound %s/n", wine_dbgstr_rect(&r));    if (part->style & SBT_POPOUT)        border = BDR_RAISEDOUTER;    else if (part->style & SBT_NOBORDERS)        border = 0;    if (theme)    {        if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)            && (infoPtr->simple || (itemID == (infoPtr->numParts-1))))            themePart = SP_GRIPPERPANE;        DrawThemeBackground(theme, hdc, themePart, 0, &r, NULL);    }    else        DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);    if (part->hIcon) {        INT cy = r.bottom - r.top;        DrawIconEx (hdc, r.left + 2, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);        x = 2 + cy;    }    if (part->style & SBT_OWNERDRAW) {	DRAWITEMSTRUCT dis;	dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);	dis.itemID = itemID;	dis.hwndItem = infoPtr->Self;	dis.hDC = hdc;	dis.rcItem = r;	dis.itemData = (ULONG_PTR)part->text;        SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);    } else {        r.left += x;#ifdef __REACTOS__        if (!theme)            DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);        else            DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);#else        DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);#endif    }}
开发者ID:amaneureka,项目名称:reactos,代码行数:53,


示例15: xpt_DrawTheme

HRESULT	xpt_DrawTheme(XPTHANDLE xptHandle, HWND hwnd, HDC hdc, int type, int state, const RECT *sizeRect, const RECT *clipRect){	mir_cslock lck(xptCS);	if (xpt_IsThemed(xptHandle)) {		if (IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state)) {			DrawThemeParentBackground(hwnd, hdc, sizeRect);			return DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect);		}	}	return S_FALSE;}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:12,


示例16: DrawThemeBackground

void track_bar_impl::draw_channel (HDC dc, const RECT * rc) const{    if (get_theme_handle())    {        DrawThemeBackground(get_theme_handle(), dc, get_orientation() ? TKP_TRACKVERT : TKP_TRACK, TUTS_NORMAL, rc, 0);    }    else    {        RECT rc_temp = *rc;        DrawEdge (dc, &rc_temp, EDGE_SUNKEN, BF_RECT);    }}
开发者ID:samithaj,项目名称:columns_ui,代码行数:12,


示例17: LookupThemeData

/********************************************DrawBackground	Purpose		Provides a more straightforward way to draw a background by wrapping all the calls required into the dll,		as well as using our theme data mappings to find the core info required.	Params		hwnd - the HWND of the control we draw to, or NUL		hdc - the device context for the dll to draw to		type - the cell type we want to draw		state - the state of the cell we want to draw		pRect - represents the area we want to draw to		pClipRect - is exposed, but is almost always NULL	Return		A  bool to indicate success or failure, which is used to control drawing in the old style throughout the library*********************************************/bool UGXPThemes::DrawBackground(HWND hwnd, HDC hdc, UGXPCellType type, 		UGXPThemeState state, const RECT *pRect, const RECT *pClipRect){	bool success = false;	if (useThemes)	{		UGThemeData * td = LookupThemeData(type, state);		if (!td)		{			return false;		}		HANDLE hTheme = OpenThemeData(hwnd, td->GetThemeName());		if(hTheme)		{			// If the background is transparent, we draw using the Data cell type first,			// which fills the background.  DrawThemeParentBackground just plain does not work			// for us, perhaps because the parent is an owner drawn control ?			// Of course, if the Data cell type has transparency, all we can do is return E_FAILED			if (IsThemeBackgroundPartiallyTransparent(hTheme, td->GetPartID(), td->GetStateID()))			{				if (type == XPCellTypeData) return FALSE;				UGThemeData * tdCell = LookupThemeData(XPCellTypeData, (state == ThemeStatePressed || state == ThemeStateTriState) ? ThemeStateNormal : state);				HANDLE hThemeCell = OpenThemeData(hwnd, tdCell->GetThemeName());				DrawThemeBackground(hThemeCell, hdc, tdCell->GetPartID(), tdCell->GetStateID(), pRect, pClipRect);			}			success = SUCCEEDED(DrawThemeBackground(hTheme, hdc, td->GetPartID(), td->GetStateID(), pRect, pClipRect));	//		CloseThemeData(hTheme);		}	}		return success;}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:55,


示例18: CB_draw

static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags){    static const int cb_states[3][5] =    {        { CBS_UNCHECKEDNORMAL, CBS_UNCHECKEDDISABLED, CBS_UNCHECKEDHOT, CBS_UNCHECKEDPRESSED, CBS_UNCHECKEDNORMAL },        { CBS_CHECKEDNORMAL, CBS_CHECKEDDISABLED, CBS_CHECKEDHOT, CBS_CHECKEDPRESSED, CBS_CHECKEDNORMAL },        { CBS_MIXEDNORMAL, CBS_MIXEDDISABLED, CBS_MIXEDHOT, CBS_MIXEDPRESSED, CBS_MIXEDNORMAL }    };    static const int rb_states[2][5] =    {        { RBS_UNCHECKEDNORMAL, RBS_UNCHECKEDDISABLED, RBS_UNCHECKEDHOT, RBS_UNCHECKEDPRESSED, RBS_UNCHECKEDNORMAL },        { RBS_CHECKEDNORMAL, RBS_CHECKEDDISABLED, RBS_CHECKEDHOT, RBS_CHECKEDPRESSED, RBS_CHECKEDNORMAL }    };    static const int cb_size = 13;    RECT bgRect, textRect;    HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);    HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;    LRESULT checkState = SendMessageW(hwnd, BM_GETCHECK, 0, 0);    DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);    int part = ((dwStyle & BUTTON_TYPE) == BS_RADIOBUTTON) || ((dwStyle & BUTTON_TYPE) == BS_AUTORADIOBUTTON)             ? BP_RADIOBUTTON             : BP_CHECKBOX;    int state = (part == BP_CHECKBOX)              ? cb_states[ checkState ][ drawState ]              : rb_states[ checkState ][ drawState ];    WCHAR *text = get_button_text(hwnd);    GetClientRect(hwnd, &bgRect);    GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);    if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */        bgRect.top = bgRect.top + (textRect.bottom - textRect.top - cb_size) / 2;    /* adjust for the check/radio marker */    bgRect.bottom = bgRect.top + cb_size;    bgRect.right = bgRect.left + cb_size;    textRect.left = bgRect.right + 6;    if (IsThemeBackgroundPartiallyTransparent(theme, part, state))        DrawThemeParentBackground(hwnd, hDC, NULL);    DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);    if (text)    {        DrawThemeText(theme, hDC, part, state, text, lstrlenW(text), dtFlags, 0, &textRect);        HeapFree(GetProcessHeap(), 0, text);    }    if (hPrevFont) SelectObject(hDC, hPrevFont);}
开发者ID:austin987,项目名称:wine,代码行数:52,


示例19: STATUSBAR_Refresh

static LRESULTSTATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc){    RECT   rect;    HBRUSH hbrBk;    HFONT  hOldFont;    HTHEME theme;    TRACE("/n");    if (!IsWindowVisible(infoPtr->Self))        return 0;    STATUSBAR_SetPartBounds(infoPtr);    GetClientRect (infoPtr->Self, &rect);    if ((theme = GetWindowTheme (infoPtr->Self)))    {        DrawThemeBackground(theme, hdc, 0, 0, &rect, NULL);    }    else    {        if (infoPtr->clrBk != CLR_DEFAULT)            hbrBk = CreateSolidBrush (infoPtr->clrBk);        else            hbrBk = GetSysColorBrush (COLOR_3DFACE);        FillRect(hdc, &rect, hbrBk);        if (infoPtr->clrBk != CLR_DEFAULT)            DeleteObject (hbrBk);    }    hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);    if (infoPtr->simple) {	STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);    } else {        unsigned int i;	for (i = 0; i < infoPtr->numParts; i++) {	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);	}    }    SelectObject (hdc, hOldFont);    if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)            && !(GetWindowLongW (infoPtr->Notify, GWL_STYLE) & WS_MAXIMIZE))	    STATUSBAR_DrawSizeGrip (theme, hdc, &rect);    return 0;}
开发者ID:Jactry,项目名称:wine,代码行数:51,


示例20: part

/********************************************DrawBackground	Purpose		Provides a more straightforward way to draw a background by wrapping all the calls required into the dll,		as well as using our theme data mappings to find the core info required.		This version still takes a theme name instead of using our lookup		table, it's used in cases where we hard code the theme part ( such a progress bars )	Params		hwnd      - the HWND of the control we draw to, or NUL		hdc       - the device context for the dll to draw to		theme     - the name of the theme to use		iPartId   - the theme part to draw		iStateId  - the state of the part to draw		pRect     - represents the area we want to draw to		pClipRect - is exposed, but is almost always NULL	Return		A  bool to indicate success or failure, which is used to control drawing in the old style throughout the library*********************************************/bool UGXPThemes::DrawBackground(HWND hwnd, HDC hdc, LPCWSTR theme, int partID, 		int stateID,  const RECT *pRect, const RECT *pClipRect, bool useCache){	bool success = false;	if (useThemes)	{		HANDLE themeHandle = OpenThemeData(hwnd, theme, useCache);		if (themeHandle)		{			// If the background is transparent, we draw using the Data cell type first,			// which fills the background.  DrawThemeParentBackground just plain does not work			// for us, perhaps because the parent is an owner drawn control ?			// Of course, if the Data cell type has transparency, this will fail.			if (IsThemeBackgroundPartiallyTransparent(themeHandle, partID, stateID))			{				//RECT temp = *pRect;				UGThemeData * tdCell = LookupThemeData(XPCellTypeData, ThemeStateNormal);				HANDLE hThemeCell = OpenThemeData(hwnd, tdCell->GetThemeName());				DrawThemeBackground(hThemeCell, hdc, partID, stateID, pRect, pClipRect);			}			HRESULT hr = DrawThemeBackground(themeHandle, hdc, partID, stateID, pRect, pClipRect);			success = SUCCEEDED(hr);			if (!useCache)			{				CloseThemeData(themeHandle);			}		}	}	return success;}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:56,


示例21: UPDOWN_DrawBuddyBackground

/*********************************************************************** * UPDOWN_DrawBuddyBackground * * Draw buddy background for visual integration. */static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc){    RECT br, r;    HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);    if (!buddyTheme) return FALSE;    GetWindowRect (infoPtr->Buddy, &br);    MapWindowPoints (NULL, infoPtr->Self, (POINT*)&br, 2);    GetClientRect (infoPtr->Self, &r);    if (infoPtr->dwStyle & UDS_ALIGNLEFT)        br.left = r.left;    else if (infoPtr->dwStyle & UDS_ALIGNRIGHT)        br.right = r.right;    /* FIXME: take disabled etc. into account */    DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL);    return TRUE;}
开发者ID:AlexSteel,项目名称:wine,代码行数:23,


示例22: GB_draw

static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags){    static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };    RECT bgRect, textRect, contentRect;    HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);    HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;    int state = states[ drawState ];    WCHAR *text = get_button_text(hwnd);    GetClientRect(hwnd, &bgRect);    textRect = bgRect;    if (text)    {        SIZE textExtent;        GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);        bgRect.top += (textExtent.cy / 2);        textRect.left += 10;        textRect.bottom = textRect.top + textExtent.cy;        textRect.right = textRect.left + textExtent.cx + 4;        ExcludeClipRect(hDC, textRect.left, textRect.top, textRect.right, textRect.bottom);    }    GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);    ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);    if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))        DrawThemeParentBackground(hwnd, hDC, NULL);    DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);    SelectClipRgn(hDC, NULL);    if (text)    {        textRect.left += 2;        textRect.right -= 2;        DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);        HeapFree(GetProcessHeap(), 0, text);    }    if (hPrevFont) SelectObject(hDC, hPrevFont);}
开发者ID:austin987,项目名称:wine,代码行数:44,


示例23: OpenThemeData

BOOL CPropPageFrameDefault::OnEraseBkgnd(CDC* pDC){	if (IsAppThemed())	{		HTHEME hTheme = OpenThemeData(m_hWnd, L"TREEVIEW");		if (hTheme)		{			CRect	rect;			GetClientRect(rect);			DrawThemeBackground(hTheme, pDC->m_hDC, 0, 0, rect, nullptr);			CloseThemeData(hTheme);		}		return TRUE;	}	else	{		return CWnd::OnEraseBkgnd(pDC);	}}
开发者ID:AJH16,项目名称:TortoiseGit,代码行数:19,


示例24: OnEraseBackground

    LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)    {        HDC hdc = (HDC) wParam;        if (!TrayTheme)        {            bHandled = FALSE;            return 0;        }        RECT rect;        GetClientRect(&rect);        if (IsThemeBackgroundPartiallyTransparent(TrayTheme, TNP_BACKGROUND, 0))            DrawThemeParentBackground(m_hWnd, hdc, &rect);        DrawThemeBackground(TrayTheme, hdc, TNP_BACKGROUND, 0, &rect, 0);        return TRUE;    }
开发者ID:Moteesh,项目名称:reactos,代码行数:19,


示例25: dc

void CEditWithButton_Base::DrawButton(CRect rectButton){	CWindowDC dc(this);	HTHEME hButtonTheme = OpenThemeData(m_hWnd, _T("Button"));	if (hButtonTheme)	{		int ButtonState = GetButtonThemeState();		// If necessary, first fill with the edit control's background color.		if (IsThemeBackgroundPartiallyTransparent(hButtonTheme, BP_PUSHBUTTON, ButtonState))		{			HTHEME hEditTheme = OpenThemeDataEx(m_hWnd, _T("Edit"), OTD_NONCLIENT);			COLORREF BgColor = RGB(0, 0, 0);			BgColor = GetThemeSysColor(hEditTheme, (GetStyle() & (ES_READONLY | WS_DISABLED)) ? COLOR_3DFACE : COLOR_WINDOW);			dc.FillSolidRect(rectButton, BgColor);			CloseThemeData(hEditTheme);		}		DrawThemeBackground(hButtonTheme, dc, BP_PUSHBUTTON, ButtonState, rectButton, NULL);		DrawButtonContent(dc, rectButton, hButtonTheme);		CloseThemeData(hButtonTheme);	}	else	{		UINT uState = DFCS_BUTTONPUSH;		if (GetStyle() & (ES_READONLY | WS_DISABLED))			uState |= DFCS_INACTIVE;		else if (m_IsButtonPressed)			uState |= DFCS_PUSHED;		dc.DrawFrameControl(rectButton, DFC_BUTTON, uState);		// If the button is in a pressed state, then contents should move slightly as part of the "push" effect.		if (m_IsButtonPressed)			rectButton.OffsetRect(1, 1);		DrawButtonContent(dc, rectButton, NULL);	}}
开发者ID:Samangan,项目名称:mpc-hc,代码行数:43,


示例26: nc_paint

/* Draw themed border */static void nc_paint (HTHEME theme, HWND hwnd, HRGN region){    HRGN cliprgn = region;    DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);    if (exStyle & WS_EX_CLIENTEDGE)    {        HDC dc;        RECT r;        int cxEdge = GetSystemMetrics (SM_CXEDGE),            cyEdge = GetSystemMetrics (SM_CYEDGE);        int part = EP_EDITTEXT;        int state = ETS_NORMAL;        DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);            if (!IsWindowEnabled (hwnd))            state = ETS_DISABLED;        else if (dwStyle & ES_READONLY)            state = ETS_READONLY;        else if (GetFocus() == hwnd)            state = ETS_FOCUSED;            GetWindowRect(hwnd, &r);            /* New clipping region passed to default proc to exclude border */        cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,            r.right - cxEdge, r.bottom - cyEdge);        if (region != (HRGN)1)            CombineRgn (cliprgn, cliprgn, region, RGN_AND);        OffsetRect(&r, -r.left, -r.top);            dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);        OffsetRect(&r, -r.left, -r.top);            if (IsThemeBackgroundPartiallyTransparent (theme, part, state))            DrawThemeParentBackground(hwnd, dc, &r);        DrawThemeBackground (theme, dc, part, state, &r, 0);        ReleaseDC(hwnd, dc);    }    /* Call default proc to get the scrollbars etc. also painted */    DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);}
开发者ID:GYGit,项目名称:reactos,代码行数:43,


示例27: PB_draw

static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused){    static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };    RECT bgRect, textRect;    HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);    HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;    int state = states[ drawState ];    WCHAR *text = get_button_text(hwnd);    GetClientRect(hwnd, &bgRect);    GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);    if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))        DrawThemeParentBackground(hwnd, hDC, NULL);    DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);    if (text)    {        DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);        HeapFree(GetProcessHeap(), 0, text);    }    if (focused)    {        MARGINS margins;        RECT focusRect = bgRect;        GetThemeMargins(theme, hDC, BP_PUSHBUTTON, state, TMT_CONTENTMARGINS, NULL, &margins);        focusRect.left += margins.cxLeftWidth;        focusRect.top += margins.cyTopHeight;        focusRect.right -= margins.cxRightWidth;        focusRect.bottom -= margins.cyBottomHeight;        DrawFocusRect( hDC, &focusRect );    }    if (hPrevFont) SelectObject(hDC, hPrevFont);}
开发者ID:elppans,项目名称:wine-staging-1.9.15_IndexVertexBlending-1.9.11,代码行数:39,


示例28: STATUSBAR_DrawSizeGrip

static voidSTATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect){    RECT rc = *lpRect;    TRACE("draw size grip %s/n", wine_dbgstr_rect(lpRect));    if (theme)    {        SIZE gripperSize;        if (SUCCEEDED (GetThemePartSize (theme, hdc, SP_GRIPPER, 0, lpRect,             TS_DRAW, &gripperSize)))        {            rc.left = rc.right - gripperSize.cx;            rc.top = rc.bottom - gripperSize.cy;            if (SUCCEEDED (DrawThemeBackground(theme, hdc, SP_GRIPPER, 0, &rc, NULL)))                return;        }    }    rc.left = max( rc.left, rc.right - GetSystemMetrics(SM_CXVSCROLL) - 1 );    rc.top  = max( rc.top, rc.bottom - GetSystemMetrics(SM_CYHSCROLL) - 1 );    DrawFrameControl( hdc, &rc, DFC_SCROLL, DFCS_SCROLLSIZEGRIP );}
开发者ID:ccpgames,项目名称:wine,代码行数:24,



注:本文中的DrawThemeBackground函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DrawTriangle函数代码示例
C++ DrawTexture函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。