uitable オブジェクトにおいて、セルごとに文字列の色を変更することはできますか?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 3 Aug. 2016
Bearbeitet: MathWorks Support Team
am 17 Mai 2022
uitable オブジェクトの各セルごとにテキストの色を指定する方法を教えてください。
Akzeptierte Antwort
MathWorks Support Team
am 17 Mai 2022
Bearbeitet: MathWorks Support Team
am 17 Mai 2022
R2019b 以降のリリースから uifigure 上に作成されたテーブル(uitable) もしくは uifigure を親とするコンテナーオブジェクト(uipanel や uitabなど)内に作成されたテーブルに対して、uistyle / addStyle 関数を用いて、任意のセルのテキストの色や背景色など、書式を指定することが可能です。
例:
uit = uitable(uifigure, 'Data', randn(3));
[row,col] = find(uit.Data < 0); % 負の値のインデックスを取得
s1 = uistyle;
s1.FontColor = 'red'; % テキストの色を赤色に設定
addStyle(uit,s1,'cell',[row,col]); % スタイルをテーブルに適用
詳細については、各関数のドキュメントをご覧ください。
・uistyle
・addStyle
R2019a 以前のリリースをご利用の場合は、各セルごとに、文字列の色を指定する機能はありません。ForegroundColor プロパティの指定により、一括設定することのみサポートされています。
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu App Designer を使用したアプリ開発 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!