uicontrol of pushbutton cannot set text color

2 visualizaciones (últimos 30 días)
raym
raym el 25 de Sept. de 2024
Editada: Epsilon el 25 de Sept. de 2024
% Create a figure
fig = figure;
% Create a uicontrol button with red color
btn = uicontrol('Style', 'pushbutton', 'String', 'Click Me',...
'BackgroundColor', 'r',...
'ForegroundColor ', 'g',...
'Units', 'normalized', 'Position', [0.4 0.4 0.2 0.1]);
Error using uicontrol
There is no ForegroundColor property on the UIControl class.

Respuesta aceptada

Epsilon
Epsilon el 25 de Sept. de 2024
Editada: Epsilon el 25 de Sept. de 2024
Hi raym,
Try removing the extra space after ForegroundColor.
Above mentioned code rectified:
% Create a figure
fig = figure;
% Create a uicontrol button with red color
btn = uicontrol('Style', 'pushbutton', 'String', 'Click Me',...
'BackgroundColor', 'r',...
'ForegroundColor', 'g',...
'Units', 'normalized', 'Position', [0.4 0.4 0.2 0.1]);

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by