i have no idea how to realize this feature.
My temporary solution is to place a fixed number of visible CBitmapButton and a scrollbar. Then I handle the scrollbar position changing and choose the appropriate appearance of the placed buttons.
With normal (not Mobile) MFC, the answer would be to put the CListView into Icon mode (LVS_ICON), and use an CImageList with the bitmaps. This offers 32x32 icons, and there is also a LVS_SMALLICON mode for 16x16 icons. These options may also be available for Mobile.
Related
I have created some (CMFCToolBar) toolbars and added buttons and icons to them. I read on Microsoft's official website that CMFCToolBar takes 23x22 button size and 16x15 icon size (ref: link).
If I use 16x15 for the icons, then icons appear blurry. This is because the icons are originally with size 16x16. I used the function SetSizes(CSize (23,23), CSize(16,16)) to change icon size but the icons do not appear right:
Is there another way to set icon and button size?
Update
I called the SetSize function before create toolbar but the icon still appear a little blurry:
I want to know if there is a way to set Icon/button Transparent or make it clear like we can set toolbar transparent through TBSTYLE_TRANSPARENT in CreateEx function.
SetSizes is a static function that affects the complete library.
It should be called before you create any toolbar or menu object.
Best location is in InitInstance of you applicxation.
But my tipp: Use the sizes that are recommended! 16x15 and 23x22....
Transparency can be done with standard 32bit RGB/A bitmaps.
If you have a 16 color bitmap you should use RGB(192,192,192) as the standard color for the background. It is automatically replaced with the needed background color.
This has been answered here too.
I want to make my own scrollbars for a custom drawn plot, like this image, what would be the best way to go?
Scrollbars should:
Only be visible when mouse hover over it (with fade in/out)
Be a part of the x/y axis of the plot, like in the picture
Not have any arrow buttons, just the thumb Thinner than the normal scrollbars
Would you suggest to:
Create everything from scratch, handling paging, scrollwheel etc.
Try to inherit CScrollBar and do my own drawing?
From what I've read, it's not very easy to customize scrollbars in MFC, for example here)
First off, these have to be scrollbar (or other) controls, not window scrollbars (used for scrolling a window).
Second, the statement "it's not very easy to customize scrollbars in MFC", is only partially true. MFC is a "thin wrapper" of Windows API, so you should better refer to the documentation of the Windows scrollbar control.
Then there is the CScrollBar class, but took a short look, and indeed, it does not really offer anything more than the Windows scrollbar does. As for the sample in the link you posted is a new (custom) control (painting everything on its own), i.e. literally "from scratch", not inheriting anything from CScrollBar.
So, you have to look into the Windows scrollbar control, and what it offers. Did take a look, and saw few things. Unfortunately there seems to be no owner-draw functionality. You can process the WM_CTLCOLORSCROLLBAR message, but this only allows you to change colors.
And according to the documentation the background color only. This appears to be the only possible customization, apart from the SBM_ENABLE_ARROWS message, which can hide the arrows. And no fading effect. If these are enough to you, you could try the Windows/MFC scrollbar, otherwise try writing your own.
I need a dialog box where I can choose colour, font format, font style, and font size. I mean using wxWidgets (need a dialog with wxColourDialog and wxFontDialog in a same dialog box).
Notice that under Windows the native font selection dialog already allows you to select the font colour too. This is not the case under the other platforms however, so you would need to use the non-native, and hence ugly, wxGenericFontDialog there if you really need to select both at once.
I have an MFC form, basic stuff, a few group boxes, a few text boxes, some buttons, and a list box. What I'd like to do is add a border around all of it, preferably without a group box. Like, drawing lines along the right areas. I was told this is bad to do on a dialog though. What would I need to go about doing something like that?
I am currently using MFC C++ with Visual Studio 2008.
The easiest way is to add a Picture control to the dialog and set the style to have a border only. If the control has a width or height of 0 you can get a single line. Doing it in the dialog editor will only give you positioning down to the dialog unit, if you need pixel level control you'll have to create or reposition it in OnInitDialog.
I have a UI C++ Win32/WTL app. I have an application icon with many embedded sizes, including 16x16, 32x32, 48x48 and 64x64. I do a SetIcon() for both small and large icons and yet my Windows 7 task bar shows a blurry scaled up icon.
Are there any special APIs that need to be called or some special considerations?
The icon shown in the taskbar is not the one you set with SetIcon() but the one that explorer also shows for the exe file itself. That means it shows the very first icon in your exe resources.
Change the resource ID of your icon to e.g. 1 so it's the first icon, or add other sizes to the first icon your exe currently uses.
Icons are in the order? I have information, that Windows use icons in direct order. Try place icon 64x64 in the first place in array.
Unusual DPI / font size setting? I've seen XP ask for a 20x20 icon.