Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

WarnerYoung

@WarnerYoung
About
Posts
2
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem with ClearType text in custom control
    W WarnerYoung

    I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young

    C / C++ / MFC question graphics help json performance

  • Mixing UxTheme calls with GDI+
    W WarnerYoung

    I have a set of custom controls (for pushbutton, checkbox and radiobutton) originally written in C++ and using standard GDI. Last year I added support for UxTheme API, and everything seems to work okay. Right now, I'm adding GDI+ support, and most things seem to work fine. The only problem is that I can't get UxTheme API and GDI+ to work together perfectly. It's *almost* right, but not quite. The code for this looks roughly like: hdcScrn = BeginPaint( hwnd, &ps ); hdcOffscreen = CreateCompatibleDC( hdcScrn ); hbmpBuffer = CreateCompatibleBitmap( hdcScrn, nWidth, nHeight ); SelectObject( hdcOffscreen, hbmpBuffer ); // Some code to blit the current window background // to the offscreen buffer in hbmpBuffer first. DrawThemeBackground( hTheme, hdcOffscreen, BP_PUSHBUTTON, nState, lprcClient, NULL ); BitBlt( hdcScrn, 0, 0, nWidth, nHeight, hdcOffscreen, 0, 0, SRCCOPY ); The new GDI+ version is pretty similar, except that I'm using Graphics* and Bitmap* objects. When I get to the part for DrawThemeBackground, I'm doing this: hdcReal = hGrfx->GetHDC(); DrawThemeBackground( hTheme, hdcReal, BP_PUSHBUTTON, nState, lprcClient, NULL ); hGrfx->ReleaseHDC( hdcReal ); The problem is, when I draw the offscreen buffer back to the screen, the edges of the pushbutton are too dark. It looks almost as if UxTheme call is not using alpha correctly, so the outer edges are too dark. I'm not sure if there's a good way to post screenshots on the site, so I've posted them on my own site. std GDI version GDI+ version As you can see, the dialog background is a custom texture, so I don't think I can call DrawThemeParentBackground. Anyone hints or help on this would be greatly appreciated. -- Warner Young

    C / C++ / MFC graphics c++ help winforms com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups