|
Thanks to everyone that participated in the second Spot the Bug contest this week. As "patters" pointed out, the application compatibility issue was hard coding icon sizes. Everyone else had very valid points about memory allocation, color capabilities etc., but remember - the focus is on maximizing compatibility for Windows Mobile.
Take a look at the following snippet from the contest code sample: void CTestAppDlg::initializeListCtrl() { // Create the imagelist and assign it to the listview control m_imageList.Create(32, 32, ILC_COLOR|ILC_MASK, 1, 1); m_wndListCtrl.SetImageList(&m_imageList, LVSIL_NORMAL); // Add an icon to the imagelist HICON hIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 32, 32, 0); m_imageList.Add(hIcon); } When creating the imagelist above, we're hard coding the width and height (32x32). When loading the icon, we're hard coding the same sizes again. As Windows Mobile developers, you should know that Pocket PC and Smartphone devices do not always use standard desktop icon sizes. Because these devices come in various DPIs and resolutions, the icon sizes vary. Here's a handy reference table that will help you determine which icon sizes to include in your application.
Device | DPI | Small Icons | Large Icons
|
|
|
|
|
|