![]() |
1
4
此页面显示了控件的一些大小调整指南。注意,大小以DLU(对话框单位)和像素表示,具体取决于是否将控件放置在对话框上: http://msdn.microsoft.com/en-us/library/aa511279.aspx#controlsizing
我以为
|
![]() |
2
2
我已经有一段时间没有做这方面的工作了,所以我所描述的是我所做的,不一定是对这个问题的直接回答。
case WM_MEASUREITEM: lpmis = (LPMEASUREITEMSTRUCT) lParam; lpmis->itemHeight = 13; lpmis->itemWidth = 13; break; case WM_DRAWITEM: lpdis = (LPDRAWITEMSTRUCT) lParam; hdcMem = CreateCompatibleDC(lpdis->hDC); if (lpdis->itemState & ODS_CHECKED) // if selected { SelectObject(hdcMem, hbmChecked); } else { if (lpdis->itemState & ODS_GRAYED) { SelectObject(hdcMem, hbmDefault); } else { SelectObject(hdcMem, hbmUnChecked); } } StretchBlt( lpdis->hDC, // destination DC lpdis->rcItem.left, // x upper left lpdis->rcItem.top, // y upper left // The next two lines specify the width and // height. lpdis->rcItem.right - lpdis->rcItem.left, lpdis->rcItem.bottom - lpdis->rcItem.top, hdcMem, // source device context 0, 0, // x and y upper left 13, // source bitmap width 13, // source bitmap height SRCCOPY); // raster operation DeleteDC(hdcMem); return TRUE; 这似乎对Win2000和XP都很有效,尽管我不知道Vista会做什么。 也许值得做一个实验,看看省略WM_MEASUREITEM会做什么,尽管我通常会发现,我通常有很好的理由去做一些看起来多余的事情。 |
![]() |
Paimiya · C#GDI如何绘制适合矩形的文本? 7 年前 |
|
Mohab Mesherf · 在CImage对象上使用设备上下文绘制线条 10 年前 |
![]() |
ColmanJ BrokenGlass · 透明分层窗口白色 11 年前 |