uniGUI学习之UniStringGrid(35)
程序员文章站
2022-06-09 16:37:40
请问uniListBox如何调整某行内容的字体颜色 用一个只有一列的UniStringGrid代替 object UniStringGrid1: TUniStringGrid Left = 312 Top = 58 Width = 320 Height = 240 Hint = '' FixedCo ......
请问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;
上一篇: Python装饰器基础详解