lrstndm Posted August 14, 2013 Share Posted August 14, 2013 (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 August 14, 2013 by lrstndm Link to comment Share on other sites More sharing options...
lrstndm Posted August 14, 2013 Author Share Posted August 14, 2013 After guessing some combination I got the default values _WinAPI_CreateFont(15,6,0,0, 400, False, False, False, 1, 0, 0, 0, 0, 'Segoe UI') Link to comment Share on other sites More sharing options...
Artisan Posted August 14, 2013 Share Posted August 14, 2013 (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 August 14, 2013 by Artisan Link to comment Share on other sites More sharing options...
FireFox Posted August 14, 2013 Share Posted August 14, 2013 For default values and everything related to the CreateFont function, see here. Link to comment Share on other sites More sharing options...
lrstndm Posted August 16, 2013 Author Share Posted August 16, 2013 Thank you Artisan and FireFox, I will look at it:) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now