这篇教程C++ DeleteObject函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DeleteObject函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteObject函数的具体用法?C++ DeleteObject怎么用?C++ DeleteObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DeleteObject函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetWindowDC void NativeTextfieldWin::OnNCPaint(HRGN region) { if(!textfield_->draw_border()) { return; } HDC hdc = GetWindowDC(); RECT window_rect; GetWindowRect(&window_rect); // Convert to be relative to 0x0. ::OffsetRect(&window_rect, -window_rect.left, -window_rect.top); ExcludeClipRect(hdc, window_rect.left+content_insets_.left(), window_rect.top+content_insets_.top(), window_rect.right-content_insets_.right(), window_rect.bottom-content_insets_.bottom()); HBRUSH brush = CreateSolidBrush(bg_color_); FillRect(hdc, &window_rect, brush); DeleteObject(brush); int part; int state; if(base::win::GetVersion() < base::win::VERSION_VISTA) { part = EP_EDITTEXT; if(!textfield_->IsEnabled()) { state = ETS_DISABLED; } else if(textfield_->read_only()) { state = ETS_READONLY; } else if(!contains_mouse_) { state = ETS_NORMAL; } else { state = ETS_HOT; } } else { part = EP_EDITBORDER_HVSCROLL; if(!textfield_->IsEnabled()) { state = EPSHV_DISABLED; } else if(GetFocus() == m_hWnd) { state = EPSHV_FOCUSED; } else if(contains_mouse_) { state = EPSHV_HOT; } else { state = EPSHV_NORMAL; } // Vista doesn't appear to have a unique state for readonly. } int classic_state = (!textfield_->IsEnabled() || textfield_->read_only()) ? DFCS_INACTIVE : 0; gfx::NativeThemeWin::instance()->PaintTextField(hdc, part, state, classic_state, &window_rect, bg_color_, false, true); // NOTE: I tried checking the transparent property of the theme and invoking // drawParentBackground, but it didn't seem to make a difference. ReleaseDC(hdc); }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:82,
示例2: MainWindowProcedure// Handles OS messages, is driven by the 'main loop' above.LRESULT CALLBACK MainWindowProcedure(HWND windowHandle, UINT messageCode, WPARAM wParam, LPARAM lParam){ switch (messageCode) { // On window creation. case WM_CREATE: DEBUG_OUT(TEXT("WM_CREATE message")); // Start game loop timer. DEBUG_VAL(TEXT("SetTimer()"), SetTimer(windowHandle, MAIN_CYCLE_TIMER_ID, MAIN_CYCLE_WAIT, NULL)); break; // Upon redraw request or something else changing we draw the window. case WM_PAINT: { PAINTSTRUCT paintJobStruct; HDC deviceContextHandle = BeginPaint(windowHandle, &paintJobStruct); HDC bufferDeviceContextHandle = CreateCompatibleDC(deviceContextHandle); HBITMAP bufferBitmapHandle = CreateCompatibleBitmap(deviceContextHandle, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT); HGDIOBJ oldBufferBitmapHandle = SelectObject(bufferDeviceContextHandle, bufferBitmapHandle); Gdiplus::Graphics graphics(bufferDeviceContextHandle); graphics.SetSmoothingMode(GRAPHICS_SMOOTHING_MODE); DrawGame(graphics, *mainGameObject); BitBlt(deviceContextHandle, 0, 0, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT, bufferDeviceContextHandle, 0, 0, SRCCOPY); SelectObject(bufferDeviceContextHandle, oldBufferBitmapHandle); DeleteDC(bufferDeviceContextHandle); DeleteObject(bufferBitmapHandle); EndPaint(windowHandle, &paintJobStruct); } break; // When a user presses a key (can be triggered by auto-repeat). case WM_KEYDOWN: DEBUG_OUT(TEXT("WM_KEYDOWN message")); DEBUG_VAL(TEXT("wParam"), wParam); switch(wParam) { case VK_LEFT: case VK_UP: case VK_RIGHT: case VK_DOWN: DEBUG_OUT(TEXT("Arrow key pressed")); mainGameObject->Input(wParam); } break; case WM_TIMER: if (wParam == MAIN_CYCLE_TIMER_ID) { // This is where the 'main game loop' kicks in. This line should be reached at a frequency of about 60Hz. mainGameObject->Step(windowHandle); RedrawWindow(windowHandle, NULL, NULL, RDW_INVALIDATE); //InvalidateRect(windowHandle, NULL, TRUE); //UpdateWindow(windowHandle); } break; case WM_CLOSE: DEBUG_OUT(TEXT("WM_CLOSE message")); // Clean up Windows API objects and etc. KillTimer(windowHandle, MAIN_CYCLE_TIMER_ID); DestroyWindow(windowHandle); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(windowHandle, messageCode, wParam, lParam); break; } return 0;}
开发者ID:Veltas,项目名称:recursive-maze-game,代码行数:71,
示例3: drawbmpstatic void drawbmp(fz_context *ctx, fz_document *doc, fz_page *page, fz_display_list *list, int pagenum, fz_cookie *cookie){ float zoom; fz_matrix ctm; fz_irect ibounds; fz_rect bounds, tbounds; int w, h; fz_device *dev; HDC dc, dc_main; RECT rc; HBRUSH bg_brush; HBITMAP hbmp; BITMAPINFO bmi = { 0 }; int bmp_data_len; unsigned char *bmp_data; int as_tga = !strstr(output, ".bmp"); fz_bound_page(doc, page, &bounds); zoom = resolution / 72; fz_pre_scale(fz_rotate(&ctm, rotation), zoom, zoom); tbounds = bounds; fz_round_rect(&ibounds, fz_transform_rect(&tbounds, &ctm)); w = width; h = height; if (res_specified) { fz_round_rect(&ibounds, &tbounds); if (w && ibounds.x1 - ibounds.x0 <= w) w = 0; if (h && ibounds.y1 - ibounds.y0 <= h) h = 0; } if (w || h) { float scalex = w / (tbounds.x1 - tbounds.x0); float scaley = h / (tbounds.y1 - tbounds.y0); fz_matrix scale_mat; if (w == 0) scalex = fit ? 1.0f : scaley; if (h == 0) scaley = fit ? 1.0f : scalex; if (!fit) scalex = scaley = min(scalex, scaley); fz_concat(&ctm, &ctm, fz_scale(&scale_mat, scalex, scaley)); tbounds = bounds; fz_transform_rect(&tbounds, &ctm); } fz_round_rect(&ibounds, &tbounds); fz_rect_from_irect(&tbounds, &ibounds); w = ibounds.x1 - ibounds.x0; h = ibounds.y1 - ibounds.y0; dc_main = GetDC(NULL); dc = CreateCompatibleDC(dc_main); hbmp = CreateCompatibleBitmap(dc_main, w, h); DeleteObject(SelectObject(dc, hbmp)); SetRect(&rc, 0, 0, w, h); bg_brush = CreateSolidBrush(RGB(0xFF,0xFF,0xFF)); FillRect(dc, &rc, bg_brush); DeleteObject(bg_brush); dev = fz_new_gdiplus_device(ctx, dc, &tbounds); if (list) fz_run_display_list(list, dev, &ctm, &tbounds, cookie); else fz_run_page(doc, page, dev, &ctm, cookie); fz_free_device(dev); bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); bmi.bmiHeader.biWidth = w; bmi.bmiHeader.biHeight = as_tga ? -h : h; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = as_tga ? 32 : 24; bmi.bmiHeader.biCompression = BI_RGB; bmp_data_len = as_tga ? w * h * 4 : ((w * 3 + 3) / 4) * 4 * h; bmp_data = fz_malloc(ctx, bmp_data_len); if (!GetDIBits(dc, hbmp, 0, h, bmp_data, &bmi, DIB_RGB_COLORS)) fz_throw(ctx, "cannot draw page %d in PDF file '%s'", pagenum, filename); DeleteDC(dc); ReleaseDC(NULL, dc_main); DeleteObject(hbmp); if (output) { char buf[512]; FILE *f; sprintf(buf, output, pagenum); f = fopen(buf, "wb"); if (!f) fz_throw(ctx, "could not create raster file '%s'", buf); if (as_tga) {//.........这里部分代码省略.........
开发者ID:Jshauk,项目名称:sumatrapdf,代码行数:101,
|