Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Using Theming with GDI

4: Adsense

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   

381
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




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.