Jump to content

Recommended Posts

Posted (edited)

I have a Listview in a GUI control.

I'm changing the text font using the _WinAPI_CreateFont(...) method, but when I want to set it back to default I don't know the values.

How can I get these values, or what are the values?

Thanks.

regards,

lrstndm

Edited by lrstndm
Posted (edited)

The default values can vary, depending on what version of Windows is running and what theme is applied (can vary from user to user on the same machine).

It's much better to just save the old font when you switch it.  _WinAPI_SelectObject() returns the pre-existing value that's being over-written, so an example is:

$hOldFont = _WinAPI_SelectObject($hDC, $NewFont)

You only need to do that the first time your script selects a different font.

 

Then, when you're releasing the font you made, you do this:

_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hNewFont)

This restores the original font to the device context.

Edited by Artisan

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...