News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Displaying a chess board: WM_SETFONT & WM_ERASEBKGND problems

Started by jj2007, November 24, 2014, 10:15:05 AM

Previous topic - Next topic

jj2007

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$)

jj2007

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:

Gunther

Jochen,

displays the chess board without the black basic row.

Gunther
You have to know the facts before you can distort them.

jj2007

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.

Gunther

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
You have to know the facts before you can distort them.