TabControl Left Alignment

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
travisc
Posts: 9
Last visit: Sat Sep 24, 2022 7:49 am

TabControl Left Alignment

Post by travisc »

So I'm working on a new project and trying to use the tab control as a way to move from one process to another. The problem is when i have the tab alignment set to top or bottom the color matches the form color, but when i change the alignment to left or right, it defaults to the control color. On another test script i am using the DrawItem to change the color of the tabs, which works great. But Is there a way to change this color on the tab control when the alignment is set to right or left.
Tab-Matching Form color.PNG
Tab-Matching Form color.PNG (5.72 KiB) Viewed 537 times

Tab-Not Matching Form color.PNG
Tab-Not Matching Form color.PNG (10.86 KiB) Viewed 537 times
jvierra
Posts: 15335
Last visit: Fri Nov 25, 2022 7:06 pm
Answers: 27
Has voted: 4 times
Been upvoted: 30 times

Re: TabControl Left Alignment

Post by jvierra »

It appears that you will have to draw the background to match the forms background. I believe this is an old issue with the tab control.
travisc
Posts: 9
Last visit: Sat Sep 24, 2022 7:49 am

Re: TabControl Left Alignment

Post by travisc »

Does anyone have a code example to do this? Right now i have the code to change the tab colors, but cant figure out how to change the background of the tab control itself. When i try to just use the $tabcontrol1.BackColor, but it doesnt take. i think its a read only property.
jvierra
Posts: 15335
Last visit: Fri Nov 25, 2022 7:06 pm
Answers: 27
Has voted: 4 times
Been upvoted: 30 times

Re: TabControl Left Alignment

Post by jvierra »

The BackColor does not change the tab control color it changes the client area.
Locked