Is it possible to change the tab color and font of a uitabgroup's tabs?

60 次查看(过去 30 天)
Is it possible to change the color of a uitabgroup's tabs as well as the font and font color? If not, is it possible to adjust the border color of the uitabgroup?
It is possible to change the background color of each tab's pane, but I do not see a way to adjust the color or font/font color of the bar or the tab name elements on it. I am on R2023b.

回答(1 个)

atharva
atharva 2023-12-15
Hey matlabuser77,
I understand that you want to know if it is possible to change the color of a uitabgroup's tabs as well as the font and font color and If not, is it possible to adjust the border color of the uitabgroup.
Yes, it is possible to adjust the border color of a uitabgroup in MATLAB. You can use the 'BorderType' property to set the type of border and the 'BorderColor' property to set the color of the border. Here's an example:
h = uitabgroup;
set(h, 'BorderType', 'line', 'BorderColor', 'red');
You can use the 'ForegroundColor' and 'BackgroundColor' property to change the font color the tabs respectively.
You can go through the official Mathworks documentation below to understand more about 'ForegroundColor'
You can change the font and font size for the title of a uitab by using the HTML formatting inside the "Title" property of the uitab. Here's an example to set the font size and font of a uitab to "12" and "Helvetica" respectively using HTML formatting:
>> tabGroup = uitabgroup(f);
>> % Use HTML formatting to specify font size
>> tab = uitab(tabgp, 'Title', '<html><font size="12">Tab 1</font></html>');
>> % Use HTML formatting to specify font face
>> tab = uitab(tabGroup, 'Title', '<html><font face="Helvetica">Tab 1</font></html>');
I hope this helps!
  2 个评论
Graham Cotgreave
Graham Cotgreave 2024-7-25
Is there anyway to achieve the same effect when running a MatLab app directly from MatLab or as a Windows compiled app, in 2022b? The trick above does not appear to work.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by