While playing with a proggie to display a chess board, I stumbled over two things:
1. In the main WndProc, a big font is created and selected via WM_SETFONT. It displays fine in the edit control. However, the DC obtained in the subclass for WM_ERASEBKGND seems to use another font; only when using ...
CASE WM_ERASEBKGND
invoke SelectObject, wParam, hFont
... results become meaningful.
2. In the edit subclass, WM_ERASEBKGND doesn't get triggered when the user edits text. Is there a default/recommended way to redraw the background?
(source attached in *asc = RTF format. Line 125 defines the Board$)
No replies?
Re the font issue: that seems badly documented, but apparently the OS uses the "good" DC with the font selected by the WM_SETFONT message during WM_PAINT, but during WM_ERASEBKGND the SYSTEM_FIXED_FONT is selected. Most probably, it's a feature :greensml:
Jochen,
displays the chess board without the black basic row.
Gunther
Quote from: Gunther on November 25, 2014, 04:53:08 AMdisplays the chess board without the black basic row.
Gunther,
Enlarging it a few pixels downwards should display the last row, too. I've not yet worked on the details, at present I only wanted to understand this DC issue.
Quote from: jj2007 on November 25, 2014, 06:08:40 AM
Enlarging it a few pixels downwards should display the last row, too. I've not yet worked on the details, at present I only wanted to understand this DC issue.
yes, that works and brings by the way another false positive by Avira.
Gunther