Jump to content

  • Log In with Google      Sign In   
  • Create Account


Using Theming with GDI


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Plerion   Members   -  Reputation: 365

Like
0Likes
Like

Posted 19 August 2012 - 11:13 AM

Hey everyone

Im currently experimenting a bit with theming provided with windows. Before i explain my problem in detail ill post the code, that makes it a lot easier to understand:

Version 1:
[source lang="cpp"] IDirect3DSurface9* surf; gTexture->GetSurfaceLevel(0, &surf); HDC hDc = 0; surf->GetDC(&hDc); renderDC = CreateCompatibleDC(hDc); auto bmp = CreateCompatibleBitmap(renderDC, widht, height); SelectObject(renderDC, bmp); RECT theRect = { 0, 0, widht, height }; FillRect(renderDC, &theRect, (HBRUSH)GetStockObject(WHITE_BRUSH)); HTHEME theme = OpenThemeData(hWindow, L"BUTTON;Edit;Progress"); RECT rc = { 0, 100, 100, 120 }; DrawThemeBackground(theme, renderDC, BP_CHECKBOX, CBS_CHECKEDNORMAL, &rc, nullptr); CloseThemeData(theme); surf->ReleaseDC(hDc); surf->Release();[/source]
Later i BitBlt the content of the renderDC into a aquired DC of the surface and render the texture. What happens:
The screen ist completely white, nothing is drawn by DrawThemeBackground! If i use functions like TextOut or again FillRect with another rect everything is drawn, except the part with DrawThemeBackground.

Version 2:
I replace renderDC in FillRect and DrawThemeBackground with hDc (the DC of the surface). Result: The checkbox gets drawn as it should.

Version 3:
i do the Theme drawing (DrawThemeBackground) right where the frame rendering happens. Again i render into renderDC, and then BitBlt it to the texture. Excatly the same as version 1.

Why are versions 1 and 3 not working? renderDC is a compatible DC and all drawing works except for the stuff with theming!

Greetings
Plerion

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS