界面库

优化表格控件
This commit is contained in:
JianjunLiu
2022-11-07 17:36:30 +08:00
parent 4519cff2a0
commit 9755b27f72
11 changed files with 582 additions and 193 deletions
+99 -3
View File
@@ -570,7 +570,7 @@ type TDComponent = class()
end
return nn;
end
function SetDefalutEvent(ev);
function SetDefalutEvent(ev,ndf);
begin
if ifarray(ev) then
hs := createtslfunction(ev);
@@ -583,7 +583,8 @@ type TDComponent = class()
if CheckTslCode(r,err) then
begin
feventnametable[ev["event"]] := ev;
FDefaultEvent := ev["event"];
if not ndf then
FDefaultEvent := ev["event"];
end
end
public
@@ -2517,7 +2518,7 @@ type TDListView = class(TDComponent)
DefaultEvent := array(
"event":"onselchanged",
"name":"sel",
"param":array("o"),
"param":array("o","e"),
"virtual":true,
"body":
"
@@ -2532,6 +2533,68 @@ type TDListView = class(TDComponent)
end
end
type TDgridctl = class(TDComponent)
{**
@explan(说明) 自绘制网格 设计器控件 %%
**}
function HitTip();override;
begin
return inherited;
end
function bitmapinfo();override;
begin
return getgridctlbitmapinfo();
end
function WndClass();override;
begin
return Class(TGridCtl);
end
function Create(AOwner);override;
begin
inherited;
fiscontainerdcmp := false;
fiscontainerdcmp := false;
DefaultEvent := array(
"event":"ondrawcell",
"name":"drawcell",
"param":array("o","e"),
"virtual":true,
"body":
"
{**
@explan(说明) 绘制表格 %%
@param(o)(tlistview) grid对象 %%
@param(e)(tuieventbase) 消息对象包括,row,col,rec,cavas等属性提供绘制信息 %%
**}
//绘制表头
i := e.row;
j := e.col;
rec := e.rec;
cvs := e.canvas;
if i<o.FixedRows or j<o.FixedColumns then
begin
cvs.Draw('FrameControl',array(rec[0:1],rec[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH); //DFCS_CHECKED DFCS_FLAT
end
//绘制网格线
cvs.moveto(rec[array(2,1)]);
cvs.LineTo(rec[array(2,3)]);
cvs.LineTo(rec[array(0,3)]);
if j=0 then
begin
cvs.LineTo(rec[array(0,1)]);
end
if i=0 then
begin
cvs.MoveTo(rec[array(0,1)]);
cvs.LineTo(rec[array(2,1)]);
end
//绘制文本
cvs.drawtext(format('%d,%d',i,j),rec,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);
inherited;
");
end
end
type TDedit= class(TDComponent)
function HitTip();override;
@@ -2936,6 +2999,38 @@ type TDListBox=class(TDComponent)
function Create(AOwner);override;begin
inherited;
fiscontainerdcmp := false;
DefaultEvent := array(
"event":"onselchanged",
"name":"sel",
"virtual":true,
"param":array("o","e"),
"body":
" {**
@explan(说明) item选择改变回调 %%
@param(o)(listbox) 列表控件 %%
@param(e)(tuieventbase) 消息对象 %%
**}
echo '\\r\\n',tostn(o.ItemIndex);
inherited;");
ev := array(
"event":"ondrawlist",
"name":"draw",
"virtual":true,
"param":array("o","e"),
"body":
" {**
@explan(说明) 自绘制 %%
@param(o)(listbox) 列表控件 %%
@param(e)(tlistdrawevent) 消息对象 %%
**}
id := e.idx;
cvs := e.canvas;
rec := e.rec;
sel := e.sel;
cvs.drawtext( o.getItemText(id),rec);
inherited;");
SetDefalutEvent(ev,1);
end
function bitmapinfo();override;begin
return "0502000000060400000074797065000203000000696D670006040000006461746
@@ -3521,6 +3616,7 @@ begin
class(TDListBox),
class(TDListView),
class(TDTreeView),
class(TDgridctl),
class(TDProgressBar),
class(TDDateTimePicker),
class(TDTimePicker),
+11
View File
@@ -71,6 +71,7 @@ function getcoolbarbitmapinfo();
function gettoolbarbitmapinfo();
function getlabelbitmapinfo();
function getlistviewbitmapinfo();
function getgridctlbitmapinfo();
implementation
function getexamplesbmpinfo();
begin
@@ -1503,6 +1504,16 @@ CF7F527EA1C3DA7875C10207E7AA366E2C20907118F56AE3DA023E0ECE2A78100
4FA02DDADA8831B0B9AD8BCB2A0297CA9A0F59F7E7B0FE20F1D79BA1B7D429BC4
0000000049454E44AE42608200";
end
function getgridctlbitmapinfo();
begin
return "0502000000060400000074797065000203000000696D670006040000006461746
10002A800000089504E470D0A1A0A0000000D4948445200000012000000120806
00000056CE8E57000000017352474200AECE1CE90000000467414D410000B18F0
BFC6105000000097048597300000EC300000EC301C76FA8640000003D49444154
384F63F84F25403B83A2BDB64059C4B16180FA068124C9C13030EA35125C04031
41B04922407C3C0A8D74870110C50CD207201950CFAFF1F001BE56DAD54559407
0000000049454E44AE42608200";
end
function getsplitterbitmapinfo();
begin
return "0502000000060400000074797065000203000000696D670006040000006461746