uicontrol radiobutton label text is offset vertically
古いコメントを表示
See attached image. Is the alignment between the radiobuttons and the text correct? To me it looks like the text is too high. Is there a way to control this?
4 件のコメント
There is no documented "VerticalAlignment" property:
Most likely this behavior depends on your OS / Java / MATLAB version, which you have not told us.
uicontrol('Style','radiobutton', 'String','Micro')
CM
2025 年 4 月 20 日
移動済み: Walter Roberson
2025 年 4 月 20 日
Walter Roberson
2025 年 4 月 20 日
編集済み: Walter Roberson
2025 年 4 月 20 日
I checked, and there are no apparent internal properties for controlling text position or text alignment for uicontrol()
CM
2025 年 4 月 21 日
回答 (1 件)
Deepak
2025 年 6 月 5 日
I understand that you are noticing a slight misalignment between the radio buttons and their text labels when using "uicontrol('Style', 'radiobutton')", particularly when used inside a "uifigure". The "uicontrol" does not provide internal properties to control the vertical text alignment, so the text might appear slightly higher or off-center.
If you are working in a modern UI context, a better alternative is to use App Designer-style components such as "uibuttongroup" with "uiradiobutton", which offer improved layout and text alignment. Here is an example:
fig = uifigure;
bg = uibuttongroup(fig, 'Position', [100 100 200 100]);
uiradiobutton(bg, 'Text', 'Micro', 'Position', [10 60 100 20]);
uiradiobutton(bg, 'Text', 'Micro', 'Position', [10 40 100 20]);
uiradiobutton(bg, 'Text', 'Equal', 'Position', [10 20 100 20]);
Please find attached the documentation of functions used for referernce:
uibuttongroup: www.mathworks.com/help/matlab/ref/uibuttongroup.html
uiradiobutton: www.mathworks.com/help/matlab/ref/uiradiobutton.html
I hope this helps.
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Programmatically についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
