C++ Win32 how to remove tab borders WC_TABCONTROL - c++

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.

Related

MFC - CPropertyPageEx and scaling (4K monitor)

I'm upgrading an old MFC app to support 4K monitors. According to what information I can find, CPropertySheetEx 'implements Wizard97 style functionality'. It's a dialog with Previous and Next buttons and a banner.
Now MFC has done a poor job of scaling this dialog and I'm not sure what control I have over it.
4K is usually 200% scaling. The banner height is unchanged at 59 pixels (so is too small on a 4K monitor). The rest of the dialog seems to have scaled to about 150% (width, height).
I've tried SetWindowPos on the banner. This doesn't resize it and causes other dialog issues.
There's this note in the code, which makes me think the banner is dynamically constructed with the property sheet.
// If the page has a header, we need to paint the area above the border.
// By inspection (Spy++), the border is a static control with ID 0x3027
CWnd* pTopBorder = GetDlgItem(0x3027);
Any suggestions or guides would be appreciated.
The app is DPI aware. Many MFC components scale properly (some need some work)
Question - How can I get CPropertyPageEX dialogs to support scaling?
Here's an image ![Scaling Issue]https://imgur.com/a/Ww8SLnU
Edit -
The icon and the text in the banner can be resized and repositioned, only the height of the banner seems stuck at 50 pixels.
CPropertyPageEx is defined as CPropertyPage in MFC 11. It's derived directly from CWnd.
Having a look at the sources for CPropertyPage (atlmfc\src\mfc\dlgprop.cpp) there's no constructor where it creates buttons or banners (so I may be looking in the wrong place).
A PropertySheet seems to consist of
a graphic (user supplied),
a horizontal bar (static control),
a dialog resource from the Property Page currently displayed
another horizontal bar
a series of buttons (Prev , Next etc)
Have a look at my high def screenshot https://imgur.com/a/yR97H96
The dialog and controls have rescaled
The vertical position of the horizontal bar and the property page are both unchanged from the unscaled version, leading to the ugly overlap you can see.
.

How to collapse Gtkmm notebook tabs?

So I am making a Gtkmm application using a Gtk::notebook and during run-time I'm adding new tabs to the notebook. But when I add more tabs than there is space on my screen it just keeps going moving out of the screen.
Now I know most Gtk widgets have a lot of properties that can be configured, so I'am wondering is there such a property for notebook that automatically collapses tabs or scales them in some way to make it fit inside the widget/screen.
If not it would be great if you could give me some pointers to how to implement this functionality myself.
set_scrollable() is your best bet. It will add scrolling arrows on the sides of the tab labels at the top when there isn't enough room to show them all.
Note that GtkNotebook will always ask for enough space to show the contents of all tabs, not just the one that's currently visible. If one of your tab pages is really big (say, contains a 10x10 grid of 100x100 buttons), you won't be able to resize the GtkNotebook smaller than that tab page (in that case, 1000x1000 + the height of the label area), even if the current tab page is just an empty container. All set_scrollable() will do is let you resize smaller than the width needed to show all tab labels at the top.
Put this in your .xml GUI file in the GtkNotebook object:
<property name="scrollable">True</property>
This causes the tabs that go out of screen to be horizontal scrollable by adding arrows beside the last tab at the right and the most left tab at the left.

MFC VC++: How to remove blank space between the Window caption and Client area

I am developing a desktop app using MFC. The following image shows the current state of the app's window top part. The area marked in red is unnecessary and I want to remove it.
How can I remove that space or atleast change the color to match the rest of the window background?
More Info:
The App is using Ribbon UI. I have added the App button programmatically in onCreate of CMainFrame. Is it the bar that holds the Ribbon categories? I tried SetMenubarState(AFX_MVS_HIDDEN) thinking it was the menu bar, but that didn't work. Just changing its color is also acceptable.
Update:
I have managed to change the color of that ribbon strip, and removed the caption bar I used for showing the 'add' button. Now I need to figure out how to place the 'Add' button on the right side of the ribbon strip.

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.

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.