uitable オブジェクトにおいて​、セルごとに文字列の​色を変更することはで​きますか?

14 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 3 de Ag. de 2016
Editada: MathWorks Support Team el 17 de Mayo de 2022
uitable オブジェクトの各セルごとにテキストの色を指定する方法を教えてください。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 17 de Mayo de 2022
Editada: MathWorks Support Team el 17 de Mayo de 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 プロパティの指定により、一括設定することのみサポートされています。

Más respuestas (0)

Categorías

Más información sobre App Designer を使用したアプリ開発 en Help Center y File Exchange.

Productos


Versión

R2010a

Community Treasure Hunt

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

Start Hunting!