Hi Jeff,
I created a sample for each platform.
In .NET: a checkbox where CheckAlign is TopLeft and TextAlign is
TopLeft.
In Win32: I used the window styles BS_TOP | BS_LEFT.
When I execute the .NET code the check appears at the top + left side
of the check box control.
When I execute the Win32 code the check appears at the left side but
vertically centered to the text (not to the control).
In both cases the text is drawn fine except that in .NET it is
trimmed.
I couldn't find any value for CheckAlign that will place the check at
the same position as in Win32.
Ehud
C# Code (automatically generated by the forms designer)
=========================================
this.checkBox1.BackColor =
System.Drawing.SystemColors.Control;
this.checkBox1.CheckAlign =
System.Drawing.ContentAlignment.TopLeft;
this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans
Serif", 48F);
this.checkBox1.Location = new System.Drawing.Point(0, 0);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(231, 134);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "checkBox1";
this.checkBox1.TextAlign =
System.Drawing.ContentAlignment.TopLeft;
this.checkBox1.UseVisualStyleBackColor = false;
Win32 Code
=========================================
HWND hCheckbox = CreateWindow(WC_BUTTONW, L"checkBox1",
WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | BS_AUTOCHECKBOX |
BS_TOP | BS_LEFT,
0, 0, 231, 134, hWnd, NULL, hInstance, NULL);
LOGFONT lf;
ZeroMemory(&lf, sizeof(lf));
wcscpy_s(lf.lfFaceName, _countof(lf.lfFaceName), L"Microsoft Sans
Serif");
lf.lfHeight = 72;
lf.lfCharSet = DEFAULT_CHARSET;
HFONT hFont = CreateFontIndirect(&lf);
SendMessage(hCheckbox, WM_SETFONT, (WPARAM)hFont, (LPARAM)0);