Create borders around controls in MFC Form - c++

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.

Related

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.

C++ Win32 how to remove tab borders WC_TABCONTROL

Hi I am trying to convert an existing WC_TABCONTROL window with TCS_OWNERDRAWFIXED so that I have full control of its appearance.
But it seems all I can draw is the tab headers and even there I do not have much control on how the borders are drawn around tab page as well as tab headers.
Can someone point me to some material that explain how to custom draw, tab items and tab pages. I need to have control on how both the background and borders are drawn.

C++ WinAPI - How to make button appear pressed?

I have in my editor few editing modes. I can choose specific mode using buttons that are placed on a toolbar. I want to indicate which mode is currently on. When I press appropriate button - I want to make the clicked button remain pushed. How do I do that in WinAPI? My toolbar uses bitmaps for icons if that's relevant.
There used to be a way to get something like the look and feel of a toolbar by using a normal check box with the BS_PUSHLIKE style set. But that got broken a bit with Windows XP because of mouse hover effects, so it's not widely used any more.
If you want to create your own toolbar, without the help of MFC, there is an MSDN article that covers the creation and management of a toolbar window (actually a dedicated window class as part of the Common Controls Library).

Make thinner border for checkbox in winapi, WTL

I have the following checkbox, in visual studio I have set it's flat property to TRUE, I want to make it's rectangle border thinner. How could I do that in windows api, WTL, ATL ? C++. Is there some sort of message that I can send to the dialog in order to do this?
You can choose between control styles, e.g. flat vs. non-flat, and you can use owner drawn controls (buttons) to take over visual presentation of the control. There is no dedicated message to adjust the thickness of the box.

Changing TabControl tab title text background color c++

I am using Visual Studio 2005, C++, and I have a tabcontrol with a couple tabs. I have changed the color of each tab to have a back color of Transparent, to match the color of the rest of the program (Control grey), however the color behind the text for the title of the tab is white. Is there any way to change this?
A tab control draws itself according to the currently selected windows theme. Which ignores a custom color. This isn't something you ought to change, you typically want to honor the user's attempt to style the windows according to her selected preference.
If you really do want to override it then you can use custom drawing, the TCS_OWNERDRAWFIXED style flag and the WM_DRAWITEM message. Beware that drawing with a transparent color isn't going to work.