当前位置: 移动技术网 > IT编程>开发语言>Delphi > uniGUI学习之UniStringGrid(35)

uniGUI学习之UniStringGrid(35)

2020年04月16日  | 移动技术网IT编程  | 我要评论

请问unilistbox如何调整某行内容的字体颜色

用一个只有一列的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;
}

2. unistringgrid1->clientevents->unievents->beforeinit:
function beforeinit(sender, config)
{
    config.cls = "my-stringgrid";
}

 

设置行宽

unistringgrid1.defaultcolwidth:=200;

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网