本文整理汇总了C++中FillRect函数的典型用法代码示例。如果您正苦于以下问题:C++ FillRect函数的具体用法?C++ FillRect怎么用?C++ FillRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FillRect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RelayoutTocItem
static void RelayoutTocItem(LPNMTVCUSTOMDRAW ntvcd)
{
// code inspired by http://www.codeguru.com/cpp/controls/treeview/multiview/article.php/c3985/
LPNMCUSTOMDRAW ncd = &ntvcd->nmcd;
HWND hTV = ncd->hdr.hwndFrom;
HTREEITEM hItem = (HTREEITEM)ncd->dwItemSpec;
RECT rcItem;
if (0 == ncd->rc.right - ncd->rc.left || 0 == ncd->rc.bottom - ncd->rc.top)
return;
if (!TreeView_GetItemRect(hTV, hItem, &rcItem, TRUE))
return;
if (rcItem.right > ncd->rc.right)
rcItem.right = ncd->rc.right;
// Clear the label
RECT rcFullWidth = rcItem;
rcFullWidth.right = ncd->rc.right;
FillRect(ncd->hdc, &rcFullWidth, GetSysColorBrush(COLOR_WINDOW));
// Get the label's text
WCHAR szText[MAX_PATH];
TVITEM item;
item.hItem = hItem;
item.mask = TVIF_TEXT | TVIF_PARAM;
item.pszText = szText;
item.cchTextMax = MAX_PATH;
TreeView_GetItem(hTV, &item);
// Draw the page number right-aligned (if there is one)
WindowInfo *win = FindWindowInfoByHwnd(hTV);
DocTocItem *tocItem = (DocTocItem *)item.lParam;
ScopedMem<WCHAR> label;
if (tocItem->pageNo && win && win->IsDocLoaded()) {
label.Set(win->ctrl->GetPageLabel(tocItem->pageNo));
label.Set(str::Join(L" ", label));
}
if (label && str::EndsWith(item.pszText, label)) {
RECT rcPageNo = rcFullWidth;
InflateRect(&rcPageNo, -2, -1);
SIZE txtSize;
GetTextExtentPoint32(ncd->hdc, label, str::Len(label), &txtSize);
rcPageNo.left = rcPageNo.right - txtSize.cx;
SetTextColor(ncd->hdc, GetSysColor(COLOR_WINDOWTEXT));
SetBkColor(ncd->hdc, GetSysColor(COLOR_WINDOW));
DrawText(ncd->hdc, label, -1, &rcPageNo, DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
// Reduce the size of the label and cut off the page number
rcItem.right = std::max(rcItem.right - txtSize.cx, 0);
szText[str::Len(szText) - str::Len(label)] = '\0';
}
SetTextColor(ncd->hdc, ntvcd->clrText);
SetBkColor(ncd->hdc, ntvcd->clrTextBk);
// Draw the focus rectangle (including proper background color)
HBRUSH brushBg = CreateSolidBrush(ntvcd->clrTextBk);
FillRect(ncd->hdc, &rcItem, brushBg);
DeleteObject(brushBg);
if ((ncd->uItemState & CDIS_FOCUS))
DrawFocusRect(ncd->hdc, &rcItem);
InflateRect(&rcItem, -2, -1);
DrawText(ncd->hdc, szText, -1, &rcItem, DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_WORD_ELLIPSIS);
}
开发者ID:wyrover,项目名称:sumatrapdf,代码行数:66,代码来源:TableOfContents.cpp
示例2: P1
P1(PUBLIC pascal, void, SysError, short, errorcode)
{
GrafPort alertport;
Region viscliprgn;
HIDDEN_RgnPtr rp;
Rect r;
struct adef *ap;
char quickbytes[grafSize];
INTEGER offsetx, offsety;
Rect main_gd_rect;
#if defined (BINCOMPAT)
LONGINT tmpa5;
#endif /* BINCOMPAT */
main_gd_rect = PIXMAP_BOUNDS (GD_PMAP (MR (MainDevice)));
if (!DSAlertTab) {
#if defined (CLIFF_CENTERING_ALGORITHM)
DSAlertTab = CL((Ptr) &myalerttab);
DSAlertRect.top = CWC(64);
DSAlertRect.left = CWC(32);
DSAlertRect.bottom = CWC(190);
DSAlertRect.right = CWC(480);
#else
INTEGER screen_width = CW (main_gd_rect.right);
INTEGER screen_height = CW (main_gd_rect.bottom);
DSAlertTab = RM((Ptr) &myalerttab);
DSAlertRect.top = CW((screen_height - 126) / 3);
DSAlertRect.left = CW((screen_width - 448) / 2);
DSAlertRect.bottom = CW(CW(DSAlertRect.top) + 126);
DSAlertRect.right = CW(CW(DSAlertRect.left) + 448);
#endif
offsetx = CW (DSAlertRect.left) - 32;
offsety = CW (DSAlertRect.top) - 64;
}
else {
offsetx = offsety = 0;
}
/* IM-362 */
/* 1. Save registers and Stack Pointer */
/* NOT DONE YET... signal handlers sort of do that anyway */
/* 2. Store errorcode in DSErrCode */
DSErrCode = CW(errorcode);
/* 3. If no Cx(DSAlertTab), bitch */
if (!DSAlertTab) {
write(2, "This machine thinks its a sadmac\n",
sizeof("This machine thinks its a sadmac\n")-1);
exit(255);
}
/* 4. Allocate and re-initialize QuickDraw */
#if defined (BINCOMPAT)
a5 = (LONGINT) (long) US_TO_SYN68K (&tmpa5);
CurrentA5 = (Ptr) (long) CL(a5);
#endif /* BINCOMPAT */
InitGraf((Ptr) quickbytes + sizeof(quickbytes) - 4);
ROMlib_initport(&alertport);
SetPort(&alertport);
InitCursor();
rp.p = RM(&viscliprgn);
alertport.visRgn = alertport.clipRgn = RM(&rp);
viscliprgn.rgnSize = CWC(10);
#if 0 && !defined(MSDOS)
viscliprgn.rgnBBox = DSAlertRect;
#else
viscliprgn.rgnBBox = main_gd_rect;
#endif
/* 5, 6. Draw alert box if the errorcode is >= 0 */
TRAPBEGIN();
if (errorcode < 0)
errorcode = -errorcode;
else {
r = DSAlertRect;
FillRect(&r, white);
#if defined (OLDSTYLEALERT)
r.right = CW(CW(r.right) - (2));
r.bottom = CW(CW(r.bottom) - (2));
FrameRect(&r);
PenSize(2, 2);
MoveTo(CW(r.left)+2, CW(r.bottom));
LineTo(CW(r.right), CW(r.bottom));
LineTo(CW(r.right), CW(r.top)+2);
PenSize(1, 1);
#else /* OLDSTYLEALERT */
FrameRect(&r);
InsetRect(&r, 3, 3);
PenSize(2, 2);
FrameRect(&r);
PenSize(1, 1);
#endif /* OLDSTYLEALERT */
}
/* find appropriate entry */
//.........这里部分代码省略.........
开发者ID:nobled,项目名称:executor,代码行数:101,代码来源:syserr.c
示例3: memset
/**
* Responsible for drawing each list item.
*/
void ToggleListView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
CListCtrl& ListCtrl=GetListCtrl();
int nItem = lpDrawItemStruct->itemID;
// get item data
LV_ITEM lvi;
_TCHAR szBuff[MAX_PATH];
memset(&lvi, 0, sizeof(LV_ITEM));
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.pszText = szBuff;
lvi.cchTextMax = sizeof(szBuff);
ListCtrl.GetItem(&lvi);
RECT rDraw;
CopyRect ( &rDraw, &lpDrawItemStruct->rcItem );
rDraw.right = rDraw.left + TOGGLELIST_ITEMHEIGHT;
rDraw.top ++;
rDraw.right ++;
FrameRect ( lpDrawItemStruct->hDC, &rDraw, (HBRUSH)GetStockObject ( BLACK_BRUSH ) );
rDraw.right --;
FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DFACE ) );
Draw3dRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DHILIGHT ), GetSysColorBrush ( COLOR_3DSHADOW ) );
InflateRect ( &rDraw, -3, -3 );
Draw3dRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DSHADOW ), GetSysColorBrush ( COLOR_3DHILIGHT ) );
switch(GetToggleState(lvi.iItem)) {
case TOGGLE_STATE_DISABLED:
if(disabledIcon) {
DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, disabledIcon, 16, 16,0, NULL, DI_NORMAL );
}
break;
case TOGGLE_STATE_ON:
if(onIcon) {
DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, onIcon, 16, 16,0, NULL, DI_NORMAL );
}
break;
case TOGGLE_STATE_OFF:
if(offIcon) {
DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, offIcon, 16, 16,0, NULL, DI_NORMAL );
}
break;
};
CopyRect ( &rDraw, &lpDrawItemStruct->rcItem );
rDraw.left += TOGGLELIST_ITEMHEIGHT;
rDraw.left += 1;
if ( lpDrawItemStruct->itemState & ODS_SELECTED ) {
FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) );
} else {
FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_WINDOW ) );
}
rDraw.left += TEXT_OFFSET;
int colorIndex = ( (lpDrawItemStruct->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT );
SetTextColor ( lpDrawItemStruct->hDC, GetSysColor ( colorIndex ) );
DrawText ( lpDrawItemStruct->hDC, szBuff, strlen(szBuff), &rDraw, DT_LEFT|DT_VCENTER|DT_SINGLELINE );
}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:72,代码来源:ToggleListView.cpp
示例4: ColorDLG
/* Dialog procedure for the color selection dialog
* Parameters:
* hDlg - The dialog handle
* message - The message received
* wParam - The first message parameter
* lParam - The second message parameter
* Returns:
* TRUE if the message was processed, FALSE otherwise
*/
LRESULT CALLBACK ColorDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
static HBRUSH hBrushWhite, hBrushBlack, hBrushDarkBlue, hBrushDarkGreen, hBrushRed,
hBrushDarkRed, hBrushPurple, hBrushOrange, hBrushYellow, hBrushGreen, hBrushVDarkGreen,
hBrushLightBlue, hBrushBlue, hBrushPink, hBrushDarkGray, hBrushGray;
static UINT ResultMsg = 0;
switch (message)
{
case WM_INITDIALOG:
hBrushWhite = CreateSolidBrush(RGB(255,255,255));
hBrushBlack = CreateSolidBrush(RGB(0,0,0));
hBrushDarkBlue = CreateSolidBrush(RGB(0,0,127));
hBrushDarkGreen = CreateSolidBrush(RGB(0,147,0));
hBrushRed = CreateSolidBrush(RGB(255,0,0));
hBrushDarkRed = CreateSolidBrush(RGB(127,0,0));
hBrushPurple = CreateSolidBrush(RGB(156,0,156));
hBrushOrange = CreateSolidBrush(RGB(252,127,0));
hBrushYellow = CreateSolidBrush(RGB(255,255,0));
hBrushGreen = CreateSolidBrush(RGB(0,252,0));
hBrushVDarkGreen = CreateSolidBrush(RGB(0,147,147));
hBrushLightBlue = CreateSolidBrush(RGB(0,255,255));
hBrushBlue = CreateSolidBrush(RGB(0,0,252));
hBrushPink = CreateSolidBrush(RGB(255,0,255));
hBrushDarkGray = CreateSolidBrush(RGB(127,127,127));
hBrushGray = CreateSolidBrush(RGB(210,210,210));
ResultMsg = (UINT)lParam;
SetFocus(NULL);
return TRUE;
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
if (wParam == IDC_WHITE)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushWhite);
if (wParam == IDC_BLACK)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushBlack);
if (wParam == IDC_DARKBLUE)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushDarkBlue);
if (wParam == IDC_DARKGREEN)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushDarkGreen);
if (wParam == IDC_RED)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushRed);
if (wParam == IDC_DARKRED)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushDarkRed);
if (wParam == IDC_PURPLE)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushPurple);
if (wParam == IDC_ORANGE)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushOrange);
if (wParam == IDC_YELLOW)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushYellow);
if (wParam == IDC_GREEN)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushGreen);
if (wParam == IDC_VDARKGREEN)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushVDarkGreen);
if (wParam == IDC_LIGHTBLUE)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushLightBlue);
if (wParam == IDC_BLUE)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushBlue);
if (wParam == IDC_PINK)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushPink);
if (wParam == IDC_DARKGRAY)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushDarkGray);
if (wParam == IDC_GRAY)
FillRect(lpdis->hDC, &lpdis->rcItem, hBrushGray);
DrawEdge(lpdis->hDC, &lpdis->rcItem, EDGE_SUNKEN, BF_RECT);
return TRUE;
}
case WM_COMMAND:
{
COLORREF clrref;
if (LOWORD(wParam) == IDC_WHITE)
clrref = RGB(255,255,255);
else if (LOWORD(wParam) == IDC_BLACK)
clrref = RGB(0,0,0);
else if (LOWORD(wParam) == IDC_DARKBLUE)
clrref = RGB(0,0,127);
else if (LOWORD(wParam) == IDC_DARKGREEN)
clrref = RGB(0,147,0);
else if (LOWORD(wParam) == IDC_RED)
clrref = RGB(255,0,0);
else if (LOWORD(wParam) == IDC_DARKRED)
clrref = RGB(127,0,0);
else if (LOWORD(wParam) == IDC_PURPLE)
clrref = RGB(156,0,156);
else if (LOWORD(wParam) == IDC_ORANGE)
clrref = RGB(252,127,0);
else if (LOWORD(wParam) == IDC_YELLOW)
clrref = RGB(255,255,0);
else if (LOWORD(wParam) == IDC_GREEN)
clrref = RGB(0,252,0);
else if (LOWORD(wParam) == IDC_VDARKGREEN)
clrref = RGB(0,147,147);
//.........这里部分代码省略.........
开发者ID:SwiftIRC,项目名称:ircd,代码行数:101,代码来源:editor.c
示例5: FillRect
void CBarShader::FillRect(CDC *dc, LPRECT rectSpan, COLORREF color, bool bFlat) {
if(!color || bFlat)
dc->FillRect(rectSpan, &CBrush(color));
else
FillRect(dc, rectSpan, GetRValue(color), GetGValue(color), GetBValue(color), false);
}
开发者ID:HackLinux,项目名称:eMule-Mirror,代码行数:6,代码来源:BarShader.cpp
示例6: PaintClc
void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
{
HDC hdcMem;
RECT clRect;
int y, indent, index, fontHeight;
struct ClcGroup *group;
HFONT hOldFont;
DWORD style = GetWindowLong(hwnd, GWL_STYLE);
int status = GetGeneralisedStatus();
int grey = 0, groupCountsFontTopShift;
HBRUSH hBrushAlternateGrey = NULL;
// yes I know about GetSysColorBrush()
COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(status) || style & WS_DISABLED)
grey = 1;
else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS)
grey = 1;
GetClientRect(hwnd, &clRect);
if (rcPaint == NULL)
rcPaint = &clRect;
if (IsRectEmpty(rcPaint))
return;
y = -dat->yScroll;
hdcMem = CreateCompatibleDC(hdc);
HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
{
TEXTMETRIC tm;
hOldFont = (HFONT)SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPS].hFont);
GetTextMetrics(hdcMem, &tm);
groupCountsFontTopShift = tm.tmAscent;
SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
GetTextMetrics(hdcMem, &tm);
groupCountsFontTopShift -= tm.tmAscent;
}
if (style & CLS_GREYALTERNATE)
hBrushAlternateGrey =
CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10)));
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
SetBkMode(hdcMem, TRANSPARENT);
{
HBRUSH hBrush;
hBrush = CreateSolidBrush(tmpbkcolour);
FillRect(hdcMem, rcPaint, hBrush);
DeleteObject(hBrush);
if (dat->hBmpBackground) {
BITMAP bmp;
HDC hdcBmp;
int x, y;
int maxx, maxy;
int destw, desth;
// XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98.
SetStretchBltMode(hdcMem, HALFTONE);
GetObject(dat->hBmpBackground, sizeof(bmp), &bmp);
hdcBmp = CreateCompatibleDC(hdcMem);
SelectObject(hdcBmp, dat->hBmpBackground);
y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0;
maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1;
maxy = dat->backgroundBmpUse & CLBF_TILEV ? maxy = rcPaint->bottom : y + 1;
switch (dat->backgroundBmpUse & CLBM_TYPE) {
case CLB_STRETCH:
if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
if (clRect.right * bmp.bmHeight < clRect.bottom * bmp.bmWidth) {
desth = clRect.bottom;
destw = desth * bmp.bmWidth / bmp.bmHeight;
}
else {
destw = clRect.right;
desth = destw * bmp.bmHeight / bmp.bmWidth;
}
}
else {
destw = clRect.right;
desth = clRect.bottom;
}
break;
case CLB_STRETCHH:
if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
destw = clRect.right;
desth = destw * bmp.bmHeight / bmp.bmWidth;
}
else {
destw = clRect.right;
desth = bmp.bmHeight;
}
break;
case CLB_STRETCHV:
if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
desth = clRect.bottom;
destw = desth * bmp.bmWidth / bmp.bmHeight;
}
else {
destw = bmp.bmWidth;
desth = clRect.bottom;
}
//.........这里部分代码省略.........
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:101,代码来源:clcpaint.cpp
示例7: WndProc
//.........这里部分代码省略.........
DeleteObject(hFont);
PostQuitMessage(0);
return 0;
}
case WM_ERASEBKGND:
{
// Don't do any erasing here. It's done in WM_PAINT to avoid flicker.
return 1;
}
case WM_VOLUMECHANGE:
{
// get the new volume level
g_pVolumeMonitor->GetLevelInfo(&g_currentVolume);
// make window visible for 2 seconds
ShowWindow(hWnd, SW_SHOW);
InvalidateRect(hWnd, NULL, TRUE);
nTimerId = SetTimer(hWnd, 101, 2000, NULL);
return 0;
}
case WM_ENDPOINTCHANGE:
{
g_pVolumeMonitor->ChangeEndpoint();
return 0;
}
case WM_TIMER:
{
// make the window go away
ShowWindow(hWnd, SW_HIDE);
KillTimer(hWnd, nTimerId);
return 0;
}
case WM_PAINT:
{
PAINTSTRUCT ps;
HPAINTBUFFER hBufferedPaint = NULL;
RECT rc;
GetClientRect(hWnd, &rc);
HDC hdc = BeginPaint(hWnd, &ps);
if (g_bDblBuffered)
{
// Get doublebuffered DC
HDC hdcMem;
hBufferedPaint = BeginBufferedPaint(hdc, &rc, BPBF_COMPOSITED, NULL, &hdcMem);
if (hBufferedPaint)
{
hdc = hdcMem;
}
}
// black background (transparency color)
FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
// Draw LEDs
for (UINT i = 0; i < (g_currentVolume.cSteps-1); i++)
{
RECT const rcLed = { DPIScale(i * 10), DPIScale(10), DPIScale(i * 10 + 8), rc.bottom-DPIScale(15) };
if ((i < g_currentVolume.nStep) && (!g_currentVolume.bMuted))
FillRect(hdc, &rcLed, hbrLit);
else
FillRect(hdc, &rcLed, hbrUnlit);
}
if (g_currentVolume.bMuted)
{
HGDIOBJ hof = SelectObject(hdc, hFont);
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, RGB(255, 64, 64));
RECT rcText = rc;
rcText.bottom -= DPIScale(11);
DrawText(hdc, L"MUTED", -1, &rcText, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
SelectObject(hdc, hof);
}
if (hBufferedPaint)
{
// end painting
BufferedPaintMakeOpaque(hBufferedPaint, NULL);
EndBufferedPaint(hBufferedPaint, TRUE);
}
EndPaint(hWnd, &ps);
return 0;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:101,代码来源:OSD.cpp
示例8: DialogProc
LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
Init(hDlg);
return TRUE;
case WM_COMMAND:
{
int id = LOWORD(wParam);
if (id == IDC_BUTTON_START)
{
server.Start();
}
if (id == ID_NOTITYICONMENU_EXIT) // 点击退出菜单,退出应用
{
Shell_NotifyIcon(NIM_DELETE,&g_nid);
EndDialog(hDlg, 0);
}
break;
}
case WM_SYSCOMMAND:
if (wParam == SC_CLOSE) // 暂时隐藏程序,不退出
{
ShowWindow(g_hMainWnd, SW_HIDE);
}
break;
case WM_AIRSOUND_NOTIFY:
if(wParam == IDC_NOTIFYICON)
{
if(lParam == WM_LBUTTONDOWN)
{
ShowWindow(g_hMainWnd, SW_SHOWNORMAL);
SetForegroundWindow(g_hMainWnd);
return TRUE;
}
if (lParam == WM_RBUTTONDOWN)
{
HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU_NOTIFYICON));
POINT point;
GetCursorPos(&point);
TrackPopupMenu(hMenu,
TPM_RIGHTBUTTON,
point.x,
point.y,
0,
g_hMainWnd,
NULL);
PostMessage(g_hMainWnd, WM_NULL, NULL, NULL);
}
}
case WM_PAINT:
{
BOOL bCompEnabled;
DwmIsCompositionEnabled(&bCompEnabled);
if (bCompEnabled)
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(g_hMainWnd, &ps);
RECT rcClient;
GetClientRect(g_hMainWnd, &rcClient);
HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0));
FillRect(hDC, &rcClient, hBrush);
DrawGlowingText(hDC, IDC_STATIC);
EndPaint(g_hMainWnd, &ps);
}
}
break;
}
return FALSE;
}
开发者ID:EndlessCheng,项目名称:AirSound,代码行数:73,代码来源:AirSoundServer.cpp
示例9: EventArea_WndProc
//.........这里部分代码省略.........
if (g_CluiData.bEventAreaEnabled)
SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0);
break;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_NOTIFYBUTTON) {
int iSelection;
MENUITEMINFO mii = {0};
POINT pt;
struct NotifyMenuItemExData *nmi = 0;
int iCount = GetMenuItemCount(g_CluiData.hMenuNotify);
BOOL result;
GetCursorPos(&pt);
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
if (iCount > 1)
iSelection = TrackPopupMenu(g_CluiData.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
else
iSelection = GetMenuItemID(g_CluiData.hMenuNotify, 0);
result = GetMenuItemInfo(g_CluiData.hMenuNotify, (UINT) iSelection, FALSE, &mii);
if (result != 0) {
nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
if (nmi) {
CLISTEVENT *cle = MyGetEvent(iSelection);
if (cle) {
CLISTEVENT *cle1 = NULL;
CallService(cle->pszService, (WPARAM) NULL, (LPARAM) cle);
// re-obtain the pointer, it may already be invalid/point to another event if the
// event we're interested in was removed by the service (nasty one...)
cle1 = MyGetEvent(iSelection);
if (cle1 != NULL)
CallService(MS_CLIST_REMOVEEVENT, (WPARAM) cle->hContact, (LPARAM) cle->hDbEvent);
}
}
}
break;
}
break;
case WM_SIZE:
if (!g_CluiData.fLayered)
InvalidateRect(hwnd,NULL,FALSE);
return DefWindowProc(hwnd, msg, wParam, lParam);
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
if (GetParent(hwnd) == pcli->hwndContactList && g_CluiData.fLayered)
CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,0);
else if (GetParent(hwnd) == pcli->hwndContactList && !g_CluiData.fLayered) {
HDC hdc, hdc2;
HBITMAP hbmp,hbmpo;
RECT rc = {0};
GetClientRect(hwnd,&rc);
rc.right++;
rc.bottom++;
hdc = GetDC(hwnd);
hdc2 = CreateCompatibleDC(hdc);
hbmp = ske_CreateDIB32(rc.right,rc.bottom);
hbmpo = (HBITMAP)SelectObject(hdc2,hbmp);
ske_BltBackImage(hwnd,hdc2,&rc);
EventArea_DrawWorker(hwnd,hdc2);
BitBlt(hdc,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,
hdc2,rc.left,rc.top,SRCCOPY);
SelectObject(hdc2,hbmpo);
DeleteObject(hbmp);
DeleteDC(hdc2);
SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
ReleaseDC(hwnd,hdc);
ValidateRect(hwnd,NULL);
}
else {
HDC hdc, hdc2;
HBITMAP hbmp, hbmpo;
RECT rc;
PAINTSTRUCT ps;
HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
GetClientRect(hwnd,&rc);
hdc = BeginPaint(hwnd,&ps);
hdc2 = CreateCompatibleDC(hdc);
hbmp = ske_CreateDIB32(rc.right,rc.bottom);
hbmpo = (HBITMAP)SelectObject(hdc2,hbmp);
FillRect(hdc2,&ps.rcPaint,br);
EventArea_DrawWorker(hwnd,hdc2);
BitBlt(hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,
hdc2,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY);
SelectObject(hdc2,hbmpo);
DeleteObject(hbmp);
DeleteDC(hdc2);
ps.fErase = FALSE;
EndPaint(hwnd,&ps);
}
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return TRUE;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:modern_clistevents.cpp
示例10: LogBegin
STDMETHODIMP CFACE::Download( BSTR URL, BSTR DownloadFile ){
USES_CONVERSION;
HANDLE hFile; TCHAR DownloadTo[ MAX_PATH ] , TXT[ 256 ] ;
HWND hDialog;
LogBegin( "File Download Method" );
LogPut( CONTINUE , IDS_LOG_DOWNLOAD , URL );
// ユーザーフォルダ名を取得
// ダイアログの作成
hDialog = CreateDialog( hInst ,MAKEINTRESOURCE( IDD_DownLoading ) ,
hWnd , (DLGPROC)DownLoadProc );
wsprintf( TXT , _T( "%s \nDown To : %s " ) , OLE2T( URL ) , OLE2T( DownloadFile ) );
SetWindowText( GetDlgItem( hDialog , IDC_Down ) ,TXT );
// そこに、ファイル名を追加することで、ダウンロード先の完成
wsprintf( DownloadTo , _T( "%s\\%s" ) , FACEDir , OLE2T( DownloadFile ) );
// ダウンロードを行う関数をロード
DWORD dwBytesWrite , dwBytesRead , dwBytesAvailable , dwTotalRead = 0;
BYTE *Buffer;
// DLL関数初期化
HANDLE hInternet = InternetOpen(
_T( "FACE Download Method" ) ,
INTERNET_OPEN_TYPE_PRECONFIG , NULL , NULL , 0 ) ,
hInternetFile = InternetOpenUrl( hInternet , OLE2T( URL ) , NULL , 0 ,0 , 0 );
LogPut( CONTINUE , IDS_LOG_DOWNLOAD , OLE2T( URL ) );
if ( hInternet == NULL || hInternetFile == NULL )
LogPut( FATAL , IDS_ERR_CANTDOWNLOAD );
// 最適サイズ取得
InternetQueryDataAvailable( hInternetFile , &dwBytesAvailable, 0, 0 );
Buffer = (BYTE*)malloc( dwBytesAvailable + 1 );
// タイムアウト設定
DWORD TimeOut;
TimeOut = 30 * 1000; // ここでは30秒に指定しています。
InternetSetOption( hInternetFile, INTERNET_OPTION_RECEIVE_TIMEOUT, &TimeOut, sizeof(TimeOut) );
// インターネットファイルの更新日時をクエリー
SYSTEMTIME LastModified;
dwBytesRead = sizeof(LastModified);
HttpQueryInfo( hInternetFile , HTTP_QUERY_LAST_MODIFIED | HTTP_QUERY_FLAG_SYSTEMTIME
, &LastModified , &dwBytesRead , 0 );
// ファイルがすでにある場合は更新日時をチェック
if ( ( hFile = CreateFile( DownloadTo , GENERIC_WRITE , 0 , NULL ,
OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL , NULL ) ) != INVALID_HANDLE_VALUE ){
// 更新日時の比較
FILETIME ft2,ft1;
SystemTimeToFileTime( &LastModified , &ft2 );
FileTimeToLocalFileTime( &ft2 , &ft1 );
GetFileTime( hFile , NULL , NULL , &ft2 );
CloseHandle( hFile );
}
hFile = CreateFile( DownloadTo , GENERIC_WRITE , 0 , NULL ,
CREATE_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL );
LONG x = -40 , ax = 1; // Progressing
do{
ZeroMemory( Buffer , sizeof(Buffer) );
// ダウンロード
InternetReadFile( hInternetFile , Buffer , dwBytesAvailable , &dwBytesRead );
sprintf( TXT , _T(
" 最適レート / 実ダウン : %d / %d Bytes" ) ,
dwBytesAvailable , dwBytesRead );
SetWindowText( GetDlgItem( hDialog , IDC_Down3 ) , TXT );
/* -- ダウンロード総容量の表示 -- */
dwTotalRead += dwBytesRead;
if ( dwTotalRead < 1000000 )
sprintf( TXT , _T(
" ダウンロード済みサイズ : %.3g KBytes" ) ,
(double)dwTotalRead / 1024 );
else
sprintf( TXT , _T(
" ダウンロード済みサイズ : %.3g MBytes " ) ,
(double)dwTotalRead / 1024 / 1024 );
SetWindowText( GetDlgItem( hDialog , IDC_Down2 ) , TXT );
// ダウンロード進行を示す プログレス
x += ax;
HDC hDC = GetDC( GetDlgItem( hDialog , IDC_PROGRESS1 ) );
RECT RT ;
GetClientRect( GetDlgItem( hDialog , IDC_PROGRESS1 ) , &RT );
if ( x < RT.left- 40 || x > RT.right + 30 ) ax *= -1;
FillRect( hDC , &RT , (HBRUSH)( COLOR_BTNFACE + 1 ) );
SetRect( &RT, x , 0 , x + 30 , 10 );
FillRect( hDC , &RT , (HBRUSH)( COLOR_ACTIVECAPTION + 1 ) );
ReleaseDC( GetDlgItem( hDialog , IDC_PROGRESS1 ) , hDC );
Buffer [ dwBytesRead ] = 0;
WriteFile( hFile , Buffer , dwBytesRead , &dwBytesWrite , NULL );
BOOL END; DoEvents( &END );if (END)break;
}while ( dwBytesRead > 0 );
//.........这里部分代码省略.........
开发者ID:ginjih,项目名称:facelib,代码行数:101,代码来源:FACE_File.cpp
示例11: CreateSolidBrush
void CLCDColorText::OnDraw(CLCDGfxBase &rGfx)
{
if(GetBackgroundMode() == OPAQUE)
{
HBRUSH backbrush = CreateSolidBrush(m_backColor);
// clear the clipped area
RECT rcClp = { 0, 0, m_Size.cx, m_Size.cy };
FillRect(rGfx.GetHDC(), &rcClp, backbrush);
// clear the logical area
RECT rcLog = { 0, 0, m_sizeLogical.cx, m_sizeLogical.cy };
FillRect(rGfx.GetHDC(), &rcLog, backbrush);
DeleteObject(backbrush);
}
if(m_nTextLength)
{
// map mode text, with transparency
int nOldMapMode = SetMapMode(rGfx.GetHDC(), MM_TEXT);
int nOldBkMode = SetBkMode(rGfx.GetHDC(), TRANSPARENT);
// select current font
HFONT hOldFont = (HFONT)SelectObject(rGfx.GetHDC(), m_hFont);
// select color
COLORREF crOldTextColor = SetTextColor(rGfx.GetHDC(), m_crForegroundColor);
if (m_bRecalcExtent)
{
int nTextFormat;
RECT rExtent;
// calculate vertical extent with word wrap
nTextFormat = (m_nTextFormat | DT_WORDBREAK | DT_CALCRECT);
rExtent.left = rExtent.top = 0;
rExtent.right = GetWidth();
rExtent.bottom = GetHeight();
DrawTextEx(rGfx.GetHDC(), (LPTSTR)m_sText.c_str(), static_cast<int>(m_nTextLength), &rExtent, nTextFormat, &m_dtp);
m_sizeVExtent.cx = rExtent.right;
m_sizeVExtent.cy = rExtent.bottom;
// calculate horizontal extent w/o word wrap
nTextFormat = (m_nTextFormat | DT_CALCRECT);
rExtent.left = rExtent.top = 0;
rExtent.right = GetWidth();
rExtent.bottom = GetHeight();
DrawTextEx(rGfx.GetHDC(), (LPTSTR)m_sText.c_str(), static_cast<int>(m_nTextLength), &rExtent, nTextFormat, &m_dtp);
m_sizeHExtent.cx = rExtent.right;
m_sizeHExtent.cy = rExtent.bottom;
m_bRecalcExtent = FALSE;
//For scrolling
m_PixelLength = m_sizeHExtent.cx;
m_StartX = 0;
if( m_bAutoScroll )
{
if( m_PixelLength > GetWidth() )
{
m_ScrollRate = -1*GetHeight();
}
else
{
m_ScrollRate = 0;
}
}
if( m_ScrollRate > 0 )
{
if( GetWidth() > m_PixelLength + m_ScrollBuffer )
{
m_JumpDistance = -1 * GetWidth();
}
else
{
m_JumpDistance = -1 * (m_PixelLength + m_ScrollBuffer);
}
}
else if( m_ScrollRate < 0 )
{
if( GetWidth() > m_PixelLength + m_ScrollBuffer )
{
m_JumpDistance = GetWidth();
}
else
{
m_JumpDistance = m_PixelLength + m_ScrollBuffer;
}
}
m_LoopX = m_JumpDistance;
}
if( IsVisible() )
{
//.........这里部分代码省略.........
开发者ID:Eagle3386,项目名称:WhatPulse-Logitech-Widget,代码行数:101,代码来源:LCDColorText.cpp
示例12: FrameWindowProc
LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
RECT rect;
MEASUREITEMSTRUCT *mis;
LPDRAWITEMSTRUCT dis;
SIZE textSize;
RECT r;
LPARAM lp;
int sel;
switch (msg) {
case WM_MEASUREITEM:
mis = (MEASUREITEMSTRUCT *)lParam;
mis->itemWidth = 100;
mis->itemHeight = options.row_height;
return TRUE;
case WM_DRAWITEM:
dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == list_hwnd) {
HBRUSH ttbrush = 0;
COLORREF tcol;
if (dis->itemID != -1) {
PINGADDRESS itemData;
{
mir_cslock lck(data_list_cs);
itemData = *(PINGADDRESS *)dis->itemData;
}
SendMessage(list_hwnd, LB_SETITEMHEIGHT, 0, (LPARAM)options.row_height);
LONG x, y;
if (context_point_valid) {
GetWindowRect(list_hwnd, &r);
x = LOWORD(context_point) - r.left;
y = HIWORD(context_point) - r.top;
}
else x = y = 0;
GetClientRect(hwnd, &r);
if ((dis->itemState & ODS_SELECTED && dis->itemState & ODS_FOCUS)
|| (context_point_valid && (x >= dis->rcItem.left && x <= dis->rcItem.right) && (y >= dis->rcItem.top && y <= dis->rcItem.bottom))) {
tcol = db_get_dw(NULL, "CLC", "SelBkColour", GetSysColor(COLOR_HIGHLIGHT));
SetBkColor(dis->hDC, tcol);
FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol)));
tcol = db_get_dw(NULL, "CLC", "SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT));
SetTextColor(dis->hDC, tcol);
}
else {
tcol = bk_col;
SetBkColor(dis->hDC, tcol);
FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol)));
tcol = db_get_dw(NULL, PLUG, "FontCol", GetSysColor(COLOR_WINDOWTEXT));
SetTextColor(dis->hDC, tcol);
}
SetBkMode(dis->hDC, TRANSPARENT);
HICON hIcon = (itemData.status != PS_DISABLED ? (itemData.status == PS_TESTING ? hIconTesting : (itemData.status == PS_RESPONDING ? hIconResponding : hIconNotResponding)) : hIconDisabled);
dis->rcItem.left += options.indent;
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top + ((options.row_height - 16) >> 1), hIcon, 0, 0, 0, NULL, DI_NORMAL);
GetTextExtentPoint32(dis->hDC, itemData.pszLabel, (int)mir_tstrlen(itemData.pszLabel), &textSize);
TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, itemData.pszLabel, (int)mir_tstrlen(itemData.pszLabel));
if (itemData.status != PS_DISABLED) {
TCHAR buf[256];
if (itemData.responding) {
mir_sntprintf(buf, TranslateT("%d ms"), itemData.round_trip_time);
GetTextExtentPoint32(dis->hDC, buf, (int)mir_tstrlen(buf), &textSize);
TextOut(dis->hDC, dis->rcItem.right - textSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, buf, (int)mir_tstrlen(buf));
}
else if (itemData.miss_count > 0) {
开发者ID:kxepal,项目名称:miranda-ng,代码行数:75,代码来源:pingthread.cpp
示例13: LConProc
//.........这里部分代码省略.........
ReleaseDC (hWnd, hdc);
view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, hWnd, NULL, inst, NULL);
if (view == NULL)
{
return -1;
}
SetWindowLong (view, GWL_ID, IDC_STATIC_TITLE);
GameTitleWindow = view;
return 0;
case WM_SIZE:
if (wParam != SIZE_MAXHIDE && wParam != SIZE_MAXSHOW)
{
LayoutMainWindow (hWnd, ErrorPane);
}
return 0;
case WM_DRAWITEM:
// Draw title banner.
if (wParam == IDC_STATIC_TITLE && DoomStartupInfo.Name.IsNotEmpty())
{
const PalEntry *c;
// Draw the game title strip at the top of the window.
drawitem = (LPDRAWITEMSTRUCT)lParam;
// Draw the background.
rect = drawitem->rcItem;
rect.bottom -= 1;
c = (const PalEntry *)&DoomStartupInfo.BkColor;
hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
DeleteObject (hbr);
// Calculate width of the title string.
SetTextAlign (drawitem->hDC, TA_TOP);
oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT));
titlelen = (int)DoomStartupInfo.Name.Len();
GetTextExtentPoint32 (drawitem->hDC, DoomStartupInfo.Name, titlelen, &size);
// Draw the title.
c = (const PalEntry *)&DoomStartupInfo.FgColor;
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
SetBkMode (drawitem->hDC, TRANSPARENT);
TextOut (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, DoomStartupInfo.Name, titlelen);
SelectObject (drawitem->hDC, oldfont);
return TRUE;
}
// Draw startup screen
else if (wParam == IDC_STATIC_STARTUP)
{
if (StartupScreen != NULL)
{
drawitem = (LPDRAWITEMSTRUCT)lParam;
rect = drawitem->rcItem;
// Windows expects DIBs to be bottom-up but ours is top-down,
// so flip it vertically while drawing it.
StretchDIBits (drawitem->hDC, rect.left, rect.bottom - 1, rect.right - rect.left, rect.top - rect.bottom,
0, 0, StartupBitmap->bmiHeader.biWidth, StartupBitmap->bmiHeader.biHeight,
ST_Util_BitsForBitmap(StartupBitmap), StartupBitmap, DIB_RGB_COLORS, SRCCOPY);
// If the title banner is gone, then this is an ENDOOM screen, so draw a short prompt
// where the command prompt would have been in DOS.
开发者ID:TerminusEst13,项目名称:GLOOME,代码行数:67,代码来源:i_main.cpp
示例14: FillRect
void CBuffer::ClearScreen(int color)
{
// Fill the backbuffer with white to erase the previous position of the bitmap
FillRect(hdcBack, &scrnRect, (HBRUSH)GetStockObject(color));
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:5,代码来源:Bitmap.cpp
示例15: gui_mch_draw_string
void
gui_mch_draw_string(
int row,
int col,
char_u *text,
int len,
int flags)
{
#ifndef MSWIN16_FASTTEXT
static int *padding = NULL;
static int pad_size = 0;
int i;
#endif
HPEN hpen, old_pen;
int y;
#ifndef MSWIN16_FASTTEXT
/*
* Italic and bold text seems to have an extra row of pixels at the bottom
* (below where the bottom of the character should be). If we draw the
* characters with a solid background, the top row of pixels in the
* character below will be overwritten. We can fix this by filling in the
* background ourselves, to the correct character proportions, and then
* writing the character in transparent mode. Still have a problem when
* the character is "_", which gets written on to the character below.
* New fix: set gui.char_ascent to -1. This shifts all characters up one
* pixel in their slots, which fixes the problem with the bottom row of
* pixels. We still need this code because otherwise the top row of pixels
* becomes a problem. - webb.
*/
HBRUSH hbr;
RECT rc;
if (!(flags & DRAW_TRANSP))
{
/*
* Clear background first.
* Note: FillRect() excludes right and bottom of rectangle.
*/
rc.left = FILL_X(col);
rc.top = FILL_Y(row);
#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* Compute the length in display cells. */
rc.right = FILL_X(col + mb_string2cells(text, len));
}
else
#endif
rc.right = FILL_X(col + len);
rc.bottom = FILL_Y(row + 1);
hbr = CreateSolidBrush(gui.currBgColor);
FillRect(s_hdc, &rc, hbr);
DeleteBrush(hbr);
SetBkMode(s_hdc, TRANSPARENT);
/*
* When drawing block cursor, prevent inverted character spilling
* over character cell (can happen with bold/italic)
*/
if (flags & DRAW_CURSOR)
{
pcliprect = &rc;
foptions = ETO_CLIPPED;
}
}
#else
/*
* Alternative: write the characters in opaque mode, since we have blocked
* bold or italic fonts.
*/
/* The OPAQUE mode and backcolour have already been set */
#endif
/* The forecolor and font have already been set */
#ifndef MSWIN16_FASTTEXT
if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width)
{
vim_free(padding);
pad_size = Columns;
padding = (int *)alloc(pad_size * sizeof(int));
if (padding != NULL)
for (i = 0; i < pad_size; i++)
padding[i] = gui.char_width;
}
#endif
/*
* We have to provide the padding argument because italic and bold versions
* of fixed-width fonts are often one pixel or so wider than their normal
* versions.
* No check for DRAW_BOLD, Windows will have done it already.
*/
#ifndef MSWIN16_FASTTEXT
ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), 0, NULL,
(char *)text, len, padding);
#else
//.........这里部分代码省略.........
开发者ID:Stolas,项目名称:vim-qt,代码行数:101,代码来源:gui_w16.c
示例16: TreeListCustomDraw
LRESULT TreeListCustomDraw(
HWND hwndHeader,
LPNMTVCUSTOMDRAW pdraw
)
{
TCHAR textbuf[MAX_PATH];
TVITEMEX item;
HBRUSH brush;
HPEN pen;
RECT hr, ir, subr;
SIZE tsz;
LONG i, c, cx;
PTL_SUBITEMS subitem;
HGDIOBJ prev;
if ((pdraw->nmcd.dwDrawStage & CDDS_ITEM) == 0)
return CDRF_NOTIFYITEMDRAW;
RtlSecureZeroMemory(&item, sizeof(item));
RtlSecureZeroMemory(&textbuf, sizeof(textbuf));
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM | TVIF_CHILDREN | TVIF_STATE;
item.hItem = (HTREEITEM)pdraw->nmcd.dwItemSpec;
item.cchTextMax = (sizeof(textbuf) / sizeof(TCHAR)) - 1;
item.pszText = textbuf;
TreeView_GetItem(pdraw->nmcd.hdr.hwndFrom, &item);
subitem = (PTL_SUBITEMS)item.lParam;
RtlSecureZeroMemory(&hr, sizeof(hr));
TreeView_GetItemRect(pdraw->nmcd.hdr.hwndFrom, (HTREEITEM)pdraw->nmcd.dwItemSpec, &ir, TRUE);
//FillRect(pdraw->nmcd.hdc, &pdraw->nmcd.rc, GetSysColorBrush(COLOR_WINDOW));
if (item.cChildren == 1) {
RtlSecureZeroMemory(&tsz, sizeof(tsz));
if (GetThemePartSize(tl_theme, pdraw->nmcd.hdc, TVP_GLYPH, GLPS_CLOSED, NULL, TS_TRUE, &tsz) != S_OK) {
tsz.cx = 8;
tsz.cy = 8;
}
subr.top = ir.top + (((ir.bottom - ir.top) - tsz.cy) / 2);
subr.bottom = subr.top + tsz.cy;
subr.left = ir.left - tsz.cx - 3;
subr.right = ir.left - 3;
if ((item.state & TVIS_EXPANDED) == 0)
i = GLPS_CLOSED;
else
i = GLPS_OPENED;
DrawThemeBackground(tl_theme, pdraw->nmcd.hdc, TVP_GLYPH, i, &subr, NULL);
}
cx = 0;
c = Header_GetItemCount(hwndHeader);
for (i = 0; i < c; i++) {
RtlSecureZeroMemory(&hr, sizeof(hr));
Header_GetItemRect(hwndHeader, i, &hr);
if (hr.right > cx)
cx = hr.right;
}
if ((subitem) && ((pdraw->nmcd.uItemState & CDIS_FOCUS)) == 0) {
if (subitem->ColorFlags & TLF_BGCOLOR_SET) {
pdraw->clrTextBk = subitem->BgColor;
SetBkColor(pdraw->nmcd.hdc, subitem->BgColor);
}
if (subitem->ColorFlags & TLF_FONTCOLOR_SET) {
pdraw->clrText = subitem->FontColor;
SetTextColor(pdraw->nmcd.hdc, subitem->FontColor);
}
}
brush = CreateSolidBrush(pdraw->clrTextBk);
subr.top = ir.top;
subr.bottom = ir.bottom - 1;
subr.left = ir.left;
|
请发表评论