01]设置某行内容的字体颜色

02]设置某单元格无效


 用一个只有一列的UniStringGrid代替

  object UniStringGrid1: TUniStringGrid
    Left = 312
    Top = 58
    Width = 320
    Height = 240
    Hint = ''
    FixedCols = 0  //这里重要
    FixedRows = 0 //这里重要
    ColCount = 1  //这里重要
    Options = []   //这里重要
    Columns = <>
    OnDrawCell = UniStringGrid1DrawCell
  end
procedure TMainForm.UniStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
var Value: string; Attribs: TUniCellAttribs);
begin
 if ARow = 3 then
 begin
//前端显示   前端显示,后端显示,两者只能先一个
 Attribs.Font.Color:=clred;
 Attribs.Font.Size:=20;
 Attribs.Font.Name:='楷体';
  Attribs.Font.Style:=[fsBold, fsItalic];
 end;
//背景边框   前端显示,后端显示,两者只能先一个
Attribs.Style.Style := 'border: 2px solid green;border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px;background-color: rgb(0,255,255) !important'   // 直接定义样式,分号格开,但最后不要分号
Attribs.Style.Cls := 'myStyle1'  // style is defined in file "files/mycss.css"
end;
//设置行高
1. UniServerModule->CustomCSS...
.my-stringgrid .x-grid-cell {    height: 90px;}
.x-grid-td {overflow: hidden;border-width: 0;vertical-align: middle;} //居中显示
2. UniStringGrid1->ClientEvents->UniEvents->beforeInit: function beforeInit(sender, config) { config.cls = "my-stringgrid"; }

 

设置行宽

UniStringGrid1.DefaultColWidth:=200;

 02]设置某单元格无效

.x-item-disabled .x-form-field {
    opacity: 1;
    -moz-opacity: 1;
    filter: alpha(opacity=100);
    color: dimgray;
    background: gainsboro;
}
procedure TMainForm.UniStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  var Value: string; Attribs: TUniCellAttribs);
begin
  if (ACol > 5) and (ARow > 4) then  begin
    Attribs.Style.Cls :='x-item-disabled';
  end;
end;

 

总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少 总说我字太少