Modify and customize the wxColourDialog box - c++

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.

Related

How to set size and Transparent / Clear CMFCToolBar Button and Icon in mfc?

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.

How to dock horizontally Qt widgets?

I am migrating to Qt from Microsoft Visual Studio. Common design for dialog boxes in desktop applications is set of labels and fields, where dialog looks like grid with labels and related fields. So, we can have Username label and text box to the right from that label, then Password label, etc. Usually when we resize a window, label size remains fixed, and text box width is increased to fill extra space, so user has more space to enter long string in text box and see it without scrolling.
Visual Studio has docking concept to describe such layouts, so you select a control and set its resizing behavior, in our example we have to set Dock = Fill for text boxes to instruct Windows Forms how to resize them. WPF has similar functionality if you set Width = *.
However, I don't see any such properties in Qt Creator Designer.
So how to instruct Qt widget (text box for example) to fill all space available in its parent widget?
In Qt, widget geometry can be automatically managed by layouts. A widget by itself won't fill the parent. You need to set a layout on the parent widget, and add the widget to the parent. There are numerous tutorials on that.
The particular layout that would apply to your situation is QFormLayout. This answer has a complete example.

Create borders around controls in MFC Form

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.

Windows Mobile (MFC). CListView with buttons instead of usual strings?

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.

Why do I get wrong text size for the toolbar?

In a Win32 GUI application I need to determine the width of area occupied by a string on a toolbar button so that I adjust the button width accordingly. The toolbar is plain old ToolbarWindow32 windows class. I use the following code:
HDC dc = GetDC( toolbarWindowHandle );
SIZE size;
GetTextExtentPoint32( dc, stringToMeasure, tcslen(stringToMeasure), &size );
For some fixed string (say "Hello") size.cx is filled with say 72 but when I make a screenshot of the toolbar with the very same string displayed on a button I see that the string occupies say 56 pixels.
The difference clearly depends on system fonts settings. I use "large fonts" and the value obtained by code is bigger than what is occupied on screen. On machines with "small fonts" the value obtained is smaller.
I thought if I use GetTextExtentPoint32() on a window device context it will return exactly the right size. What am I doing wrong?
The font used by the toolbar won't be selected into the DC so you'll need to work out what font it is using, create a copy, select it into the DC, get the size and then select the font out (else you could end up with a resource leak). You will currently be getting the size of the system font I expect, or whatever the default DC font is.
You could try finding the font handle used by sending a WM_GETFONT message to the toolbar window but this isn't guaranteed to return the actual font used when the text is displayed. It all depends on how the toolbar works internally.
However I'm pretty sure that the Win32 toolbar uses the menu font for rendering button text, which can be discovered using a combination of SystemParametersInfo and the NONCLIENTMETRICS structure.
If I was at work I'd post some code.
Don't you just love Win32?
BTW, I use the toolbar button text feature and have never had to size the button by hand in this way.
http://msdn.microsoft.com/en-us/library/ms724947(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms724506(VS.85).asp