diff --git a/designer/utslvcldcomponents.tsf b/designer/utslvcldcomponents.tsf index 94c5304..2538b17 100644 --- a/designer/utslvcldcomponents.tsf +++ b/designer/utslvcldcomponents.tsf @@ -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 irec[3]or rec1[3]rec[2]or rec1[2]=0) then return 0; + r := GetRowIndexByPos(y); + if not(c>=0) then return 0; + for ii,v in FMergers do + begin + if v.CellInMerge(r,c)then + begin + cs := v.FCells ; + return array(cs[0],cs[1]); + end + end + return array(r,c); + end function GetRowIndexByPos(y);virtual; begin {** @@ -270,30 +294,36 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // @return(integer) 行号 **} r :=-1; - if y <= FMarginTop then return-1; + if y <= FMarginTop then return -1; if FVariableRows then begin - basex := FMarginTop-FRowWidth * GetYpos(); - x2 := FMarginTop; + if y=y then return i; + end + end + basex := FMarginTop-FRowHeight * GetYpos(); for i := 0 to FRowsHeight.length()-1 do begin vi := FRowsHeight[i]; - x2 += vi; basex += vi; - if x2 >= x then return i; - if basex >= x then return i; + if basex >= y then return i; end end else begin r := integer((y-FMarginTop)/FRowHeight); if y <= FYfiexed then begin - if r >= FItemCount then return-1; + if r >= FItemCount then return -1; return r; end ybase := GetYPos(); r += ybase; - if r >= FItemCount then return-1; + if r >= FItemCount then return -1; return r; end return r; @@ -353,16 +383,31 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // @param(i)(integer) 行号 %% @param(j)(integer) 列号 %% **} - dr := array(rec[0:1],rec[2:3]); + if Fondrawcell then + begin + e := new tgriddrawcellevent(i,j,rec,cvs); + CallMessgeFunction(Fondrawcell,self(true),e); + return ; + end + //绘制表头 if i mbLeft then return false; + fmouseleftdown := true; if FC_CURRENT=FC_SIZE then //调整大小 begin FSizeColum := 1; _wapi.ClipCursor(FCursorRect); + fcellsizerstate := 1; return true; end else if FC_CURRENT=FC_SIZE2 then begin FSizeColum := 2; _wapi.ClipCursor(FCursorRect); + fcellsizerstate := 1; return true; - end - end - function MouseUp(o,e);override; + end else + begin + //x := e.xPos; + //y := e.ypos; + //fleftdownpos := array(x,y); + //fleftdowncell := getindexbypos(x,y); + end + inherited; + end + function WMLButtonUp(o,e);override; begin + fmouseleftdown := false; + fleftdownpos := nil; + fleftdowncell := nil; if FSizeColum then begin FSizeColum := false; _wapi.ClipCursor(0); + fcellsizerstate := 3; return true; end - end - function MouseMove(o,e);override; + return inherited; + end + + function WMMouseMove(o,e);override; begin - if csDesigning in ComponentState then return false; - if not FMouseSizeColumnWidth then - begin - setcursornormal(); - return 0; - end + if csDesigning in ComponentState then return false; y := e.yPos; X := e.xpos; + if (FMouseSizeColumnWidth=0) then + begin + setcursornormal(); + return inherited; + end if FMouseSizeColumnWidth .& 1>0 then begin if x0 and GetItemCount()>0 and x>(FMarginLeft+5)and y>(FMarginTop+5) {and y<(FMarginTop+FRowHeight*FFixedRows) }then begin if FSizeColum=1 then @@ -573,6 +631,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // wd := FColsWidths[FCurrentSizeId]; UpDateColumWidth(FCurrentSizeId,wd+x-FCurrentSizePos); FCurrentSizePos := x; + fcellsizerstate := 2; return true; end else if FSizeColum=2 then @@ -580,21 +639,29 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // wd := FRowsHeight[FCurrentSizeId]; UpDateRowWidth(FCurrentSizeId,wd+y-FCurrentSizePos); FCurrentSizePos := y; + fcellsizerstate := 2; return true; end else begin + if fmouseleftdown then return inherited ; bx := basex; rc := ClientRect; if FMouseSizeColumnWidth .& 1>0 then begin for i,v in FColsWidths.Data do begin + if (x-bx-v)<-4 then + begin + break; + end if abs(x-bx-v)<3 then begin + if isinmergedcolmn(i,y+5) then break; FCurrentSizeId := i; FCurrentSizePos := x; FCursorRect := array(clientToScreen(max(bx+6,rc[0]+6),y-10),clientToScreen(rc[2],y+10)); setcursorsize(); + fcellsizerstate := 2; return true; end bx += v; @@ -605,12 +672,18 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // bx := basey; for i,v in FRowsHeight.Data do begin + if (y-bx-v)<-4 then + begin + break; + end if abs(y-bx-v)<3 then begin + if isinmergedrow(i,x+5) then break; FCurrentSizeId := i; FCurrentSizePos := y; FCursorRect := array(clientToScreen(x-10,max(rc[1]+6,bx+6)),clientToScreen(x+10,rc[3])); setcursorsize2(); + fcellsizerstate := 2; return true; end bx += v; @@ -619,8 +692,8 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // end end setcursornormal(); - return false; - end + return inherited; + end function MergeCells(cells); begin {** @@ -654,20 +727,68 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // **} FMergers := array(); end + function Recycling();override; + begin + Fondrawcell := nil; + FMergers := array(); + inherited; + end //******************* - property ItemCount read GetItemCount write SetItemCount; - property ItemHeight read FRowHeight write SetRowHeigt; - property MouseSizeCell read FMouseSizeColumnWidth write FMouseSizeColumnWidth; - property FixedRows read FFixedRows write SetFixedRows; - property FixedColumns read FColumFixed write SetFixedColumns; - property ColumnCount read GetColumnCount; + property ItemCount:integer read GetItemCount write SetItemCount; + property ItemHeight:integer read FRowHeight write SetRowHeigt; + property MouseSizeCell:bool read FMouseSizeColumnWidth write setmousesizetype; + property FixedRows:integer read FFixedRows write SetFixedRows; + property FixedColumns:integer read FColumFixed write SetFixedColumns; + property ColumnCount:integer read GetColumnCount write setcolumncount; property VariableRows read FVariableRows write SetVariableRows; + property ondrawcell:eventhandler read Fondrawcell write Fondrawcell; {** @param(ItemCount)(integer) 行数 %% @param(MouseSizeCell)(bool) 鼠标改变列宽 %% @param(FixedRows)(integer) 固定的行数作为列标 %% - **} + **} + protected + property cellsizerstate read fcellsizerstate;//调整大小 private + function isinmergedcolmn(i,y); + begin + for idx,v in FMergers do + begin + if v.c_inmerge(i,1) then + begin + r := GetRowIndexByPos(y); + if v.r_inmerge(r) then + begin + return true; + end + end + end + end + function isinmergedrow(i,x); + begin + for idx,v in FMergers do + begin + if v.r_inmerge(i,1) then + begin + c := GetColIndexByPos(x); + if v.c_inmerge(c) then + begin + return true; + end + + end + end + end + function setmousesizetype(v); + begin + if v in array(0,1,2,3) then + begin + if v<>FMouseSizeColumnWidth then + begin + FMouseSizeColumnWidth := v; + end + end + end function GetGridMargin(); begin return array(FMarginLeft,FMarginTop,FMarginRight,FMarginBottom); @@ -785,18 +906,35 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // DoControlAlign(); end end - + function clearselect(); + begin + FSelBegin := 0; + fselend := 0; + end function GetColumnCount(); begin return FColsWidths.length(); end - + function setcolumncount(n);virtual; + begin + if n>=0 and FColsWidths.length()<>n then + begin + vs := array(); + for i := 0 to n-1 do + begin + vs[i] := 100; + end + setcolumns(vs); + clearselect(); + end + end function SetItemCount(ct); begin if FItemCount <> ct and ct >= 0 then begin FItemCount := ct; if not FVariableRows then DoControlAlign(); + clearselect(); end end function SetRowHeigt(h); @@ -895,6 +1033,17 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // FC_CURRENT := FC_NORMAL; end end + private + //选中 + fleftdownpos; + fleftdowncell; + FSelBegin; + fselend; + fselbkcolor; + // + Fondrawcell; + fmouseleftdown; + fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽 FScroolChanged; FMergers; FAutoScroll; @@ -932,6 +1081,27 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // FCurrentSizeId; FCurrentSizePos; end +type tgriddrawcellevent = class(tuieventbase) +{** + @explan(说明)单元格绘制消息对象 %% + @param(row)(integer) 行号 %% + @param(col)(integer) 列号 %% + @param(rec)(array(左上右下)) 区域 %% + @param(canvas)(TCanvas) 画布 %% +**} + function create(r,c,rc,cvs); + begin + inherited create(0,0,0,0); + row := r; + col := c; + rec := rc; + canvas := cvs; + end + row; + col; + rec; + canvas; +end implementation type TPAINTCOUNT=class()//绘制标记 function create(v); @@ -957,6 +1127,16 @@ type TMerger=class()// begin return length(FCells); end + function c_inmerge(i,f); + begin + if f then return i>=fcells[1] and i=fcells[1] and i<=fcells[3]; + end + function r_inmerge(i,f); + begin + if f then return i>=fcells[0] and i=fcells[0] and i<=fcells[2]; + end function mergeid(i,j);//是否合并 begin i := FCells[0]; diff --git a/funcext/tvclib/utslvclmenu.tsf b/funcext/tvclib/utslvclmenu.tsf index 23e580e..eb36388 100644 --- a/funcext/tvclib/utslvclmenu.tsf +++ b/funcext/tvclib/utslvclmenu.tsf @@ -24,7 +24,7 @@ private FCommand :integer; FOnclick; fonchanged; - FOwnerDraw; +// FOwnerDraw; FOnselect; FOnDrawItem; //绘制 FOnMeasureItem; //测量 @@ -610,7 +610,7 @@ private FItems.clean(); FOnDesignClick := nil; FOnclick := nil; - FOwnerDraw := nil; +// FOwnerDraw := nil; FOnselect := nil; FOnDrawItem := nil; FOnMeasureItem := nil; diff --git a/funcext/tvclib/utslvclpage.tsf b/funcext/tvclib/utslvclpage.tsf index 3a6e227..3038470 100644 --- a/funcext/tvclib/utslvclpage.tsf +++ b/funcext/tvclib/utslvclpage.tsf @@ -133,8 +133,7 @@ type tcustompagecontrol = class(TCustomControl) alRight: begin if FTabItemswidth then - begin - + begin FClientarea[2] :=rec[2]-FTabItemswidth[0]; if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then begin @@ -211,9 +210,10 @@ type tcustompagecontrol = class(TCustomControl) begin if FScrollBtnRect and (not FTabRects[id]) then begin + tl := (FTabItems.length()-1); if id>FirstViewIndex then begin - while(not FTabRects[min(id+1,(FTabItems.length()-1))]) do + while(not FTabRects[min(id+1,tl)]) do begin FirstViewIndex++; CalcTabs(); @@ -221,7 +221,7 @@ type tcustompagecontrol = class(TCustomControl) end else if id=0 and id-1 and fOnSelChanging then begin - e := new tuieventbase(0,FPrevid,FCurrentid,0); //m,w,l,h + e := new tuieventbase(0,FCurrentid,id,0); //m,w,l,h doonSelChanging(self(true),e); if e.skip then return ; end @@ -252,11 +252,11 @@ type tcustompagecontrol = class(TCustomControl) end else if FTabItems.length()=0 then begin - FPrevid := FCurrentid; - FCurrentid := -1; + FPrevid := -1; + FCurrentid := -1; end end - function PaintTabs(); + function PaintTabs();//绘制tab begin dc := Canvas; dc.font := font; @@ -338,15 +338,29 @@ type tcustompagecontrol = class(TCustomControl) begin if FTabItems.length()=0 then begin - FCurrentid := -1; + FCurrentid := -1; + FPrevid := -1; end end - return setselidx(id-1); + FCurrentid := -1; + FPrevid := -1; + cid := min(max(0,id-1),FTabItems.length()-1); + if cid >=0 then + begin + return setselidx(cid); + end else + begin + if FOnSelChanged then + begin + doonSelChange(self(true),new tuieventbase(0,-1,-1,0)); + end + end end else if id= 0)then return; nn := integer(n); @@ -3148,20 +3148,59 @@ type TCustomListBoxbase=class(TCustomScrollControl) return 1; end end +type tlistdrawevent = class(tuieventbase) +{** + @explan(说明)列表绘制消息对象 %% + @param(id)(integer) 序号 %% + @param(rec)(array(左上右下)) 区域 %% + @param(sel)(bool) 选择状态 %% + @param(canvas)(TCanvas) 画布 %% +**} + function create(i,s,r,c); + begin + inherited create(0,0,0,0); + idx := i; + sel := s; + rec := r; + Canvas := c; + end + rec; + idx; + sel; + canvas; +end type TcustomListBox=class(TCustomListBoxbase) {** @explan(说明) listbox控件 %% **} + private + FListitemheigt; + protected + function GetYScrollDelta();override; + begin + if ownerdraw and FListitemheigt>0 then + begin + return FListitemheigt; + end else return inherited; + end + public function Create(AOwner);override; begin inherited; + FOwnerDraw := false; border := true; FitemData := new tnumindexarray(); FSelBegin :=-1; FSelEnd :=-1; FMultisel := false; fcheckbox := false; + fselbkcolor := 0xFFE7CB; end + function FontChanged(o);override; + begin + if fownerdraw then return ; + return inherited; + end function MouseUp(o,e);override; begin if FIsMouseDown then //已经按下过 @@ -3262,9 +3301,9 @@ type TcustomListBox=class(TCustomListBoxbase) **} r := PaintIdxBkg(idx,rc,cvs); rc1 := rc; + rc1[4]:=r; if fcheckbox then - begin - + begin h := rc[3]-rc[1]; nh := min(h,16); nnh := integer((h-nh)/2); @@ -3276,6 +3315,12 @@ type TcustomListBox=class(TCustomListBoxbase) end function PaintIdexText(idx,rc,cvs);virtual; begin + if fownerdraw and Fondrawlist then + begin + e := new tlistdrawevent(idx,rc[4],rc,cvs); + CallMessgeFunction(Fondrawlist,self(true),e); + return ; + end cvs.DrawText(getItemText(idx),rc,DT_NOPREFIX); end function getCurrentSelection();virtual; @@ -3446,10 +3491,11 @@ type TcustomListBox=class(TCustomListBoxbase) if CheckListItems(ari)then begin FitemData.Pushs(ari); - class(TCustomListBoxbase).ItemCount := FitemData.length(); + inherited SetItemCount(FitemData.length()); + //class(TCustomListBoxbase).ItemCount := ; return ItemCount-1; end - return-1; + return -1; end function insertItem(item,n);virtual; begin @@ -3535,50 +3581,7 @@ type TcustomListBox=class(TCustomListBoxbase) if FSelBegin >= 0 and FSelEnd >= FSelBegin then deleteItems(const FSelBegin,FSelEnd-FSelBegin+1); end end - function findStrBeginwith(str,b,n);virtual; - begin - {** - @explan(说明)在列表框中指定项之后查找以字符串开头的项,到达末尾即从头开始%% - @param(str)(string)给定字符串%% - @param(b)(bool)1:不区分大小写,0:区分大小写%% - @param(n)(integer)指定项下标,默认为-1%% - @return(integer)返回找到的项的下标,未找到则返回-1%% - **} - if ifnil(b)then b := 0; - if ifnil(n)then n :=-1; - if CheckListItem(str)and ifnumber(n)then - begin - if not isValidIndex(n)then n :=-1; - if b then - begin - return findBeginwithCaseIndepent(str,n); - end else - return findBeginwith(str,n); - end - ShowErrorMessage("function findStrBeginwith:ErrorParameter(s)"); - return-1; - end - function findStrExact(str,b,n);virtual; - begin - {** - @ignore(忽略) %% - @explan(说明)在列表框中指定项之后查找与字符串相同的项,到达末尾即从头开始%% - @param(str)(string)给定字符串%% - @param(b)(bool)1:不区分大小写,0:区分大小写,默认为0%% - @param(n)(integer)指定项下标,默认为-1%% - @return(integer)匹配项的索引,查找失败则返回-1%% - **} - if ifnil(b)then b := 0; - if ifnil(n)then n :=-1; - if CheckListItem(str)and ifnumber(n)then - begin - if not isValidIndex(n)then n :=-1; - if b then return findExactCaseIndepent(str,n); - else return findExact(str,n); - end - ShowErrorMessage("function findStrExact:ErrorParameter(s)"); - return -1; - end + function setData(ari);virtual; begin IncPaintLock(); @@ -3641,14 +3644,21 @@ type TcustomListBox=class(TCustomListBoxbase) function Recycling();override; begin FselectionChange := nil; + Fondrawlist := nil; return inherited; end - property ItemCount read GetItemCount; + property ItemHeight:integer read GetYScrollDelta write setItemHeight; + property ItemCount:integer read GetItemCount write SetItemCount; property Multisel:bool read FMultisel write SetMultisel; property checkbox:bool read fcheckbox write setcheckbox; property onSelectionChange read FselectionChange write FselectionChange; + property selbkcolor:color read fselbkcolor write setselbkcolor; property onSelchanged:eventhandler read FselectionChange write FselectionChange; + property ondrawlist:eventhandler read Fondrawlist write Fondrawlist; property Items:strings read GetData write setData; + property itemindex:tsl read getCurrentSelection write setCurrentSelection; + property ownerdraw:bool read fownerdraw write setownerdraw; + protected function CheckListItems(s); begin @@ -3664,7 +3674,8 @@ type TcustomListBox=class(TCustomListBoxbase) {** @explan(说明) 项检查,重写该方法可以控制项的类型 %% **} - return ifstring(s); + return true; + //return ifstring(s); end function isValidIndex(n); begin @@ -3679,15 +3690,53 @@ type TcustomListBox=class(TCustomListBoxbase) @explan(说明)(TMyarrayB) list数据数据,不要试图修改该变量 **} private + function setItemHeight(h); + begin + if h>0 and h<>FListitemheigt then + begin + FListitemheigt := integer(h); + if FOwnerDraw then + begin + doControlALign(); + InvalidateRect(nil,false); + end + end + end + function setselbkcolor(v); + begin + if (v>0 or v<0) and v<>fselbkcolor then + begin + fselbkcolor := v; + end + end + function SetItemCount(n); + begin + if fownerdraw and (n>=0) and ItemCount<>n then + begin + d := nils(n); + setData(d); + end + end + function setownerdraw(v); + begin + nv := v?true:false; + if FOwnerDraw<>nv then + begin + FOwnerDraw := nv; + if not(FListitemheigt>0) then + begin + FListitemheigt := font.Height+4; + end + end + end function PaintIdxBkg(idx,rc,cvs); begin if(idx >= min(FSelBegin,FSelEnd)and idx <= max(FSelBegin,FSelEnd))or(FMultisel=2 and FMultisel3Data[idx])then begin r := true; - cvs.brush.Color := rgb(204,231,255); - end else - cvs.Brush.Color := Color; - cvs.FillRect(rc); + cvs.brush.Color := fselbkcolor;//0xFFE7CB;//rgb(204,231,255); + cvs.FillRect(rc); + end return r; end function setcheckbox(c); @@ -3716,30 +3765,7 @@ type TcustomListBox=class(TCustomListBoxbase) begin return FitemData.Data; end - function findBeginwith(str,n); - begin - len := class(TCustomListBoxbase).ItemCount; - while i++<> len do if AnsiStartsStr(str,getItem((i+n)%len))then return(i+n)%len; - return -1; - end - function findBeginwithCaseIndepent(str,n); - begin - len := class(TCustomListBoxbase).ItemCount; - while i++<> len do if AnsiStartsText(str,getItem((i+n)%len))then return(i+n)%len; - return -1; - end - function findExact(str,n); - begin - len := class(TCustomListBoxbase).ItemCount; - while i++ <> len do if getItem((i+n)%len)=str then return(i+n)%len; - return -1; - end - function findExactCaseIndepent(str,n); - begin - len := class(TCustomListBoxbase).ItemCount; - while i++ <> len do if UpperCase(getItem((i+n)%len))=UpperCase(str)then return(i+n)%len; - return -1; - end + function SelRange(sel); begin if FSelBegin >= 0 and FSelEnd >= 0 then @@ -3826,8 +3852,12 @@ type TcustomListBox=class(TCustomListBoxbase) end if selchange then CallMessgeFunction(FselectionChange,self(true),nil); end + private + fselbkcolor; + FOwnerDraw; // FselectionCancel; FselectionChange; + Fondrawlist; FSelBegin; FSelEnd; FIsMouseDown; @@ -3854,7 +3884,6 @@ type TCustomComboBoxbase=class(TCustomControl) FListBox := CreateAlist(); if FListBox is class(TWinControl)then begin - //FListBox.Parent := self(true); FListBox.OnClose := function(o,e) begin e.skip := true; @@ -3898,15 +3927,25 @@ type TCustomComboBoxbase=class(TCustomControl) if not((FListBox is class(TWincontrol))and FListBox.WsPopUp)then return; if flg and not(FListBox.Visible)then begin + if Fondropdown then + begin + e := new tuieventbase(0,0,0,0); + CallMessgeFunction(Fondropdown,self(true),e); + end SetListBoxRect(); FListBox.OnActivate := thisfunction(ListActivate); FListBox.show(5); - CallMessgeFunction(ondropdown,self(true),e); + end else if not(flg) and FListBox.Visible then begin + if Foncloseup then + begin + e := new tuieventbase(0,0,0,0); + CallMessgeFunction(Foncloseup,self(true),e); + end FListBox.Visible := false; - CallMessgeFunction(oncloseup,self(true),e); + end end function Recycling();override; @@ -3994,14 +4033,15 @@ type TCustomComboBoxbase=class(TCustomControl) end function getlistitemcount();virtual; //获得项目 begin - return FListBox.ItemCount; + return 0; end function getlistitemheight();virtual; //获得项目高 begin - return FListBox.ItemHeight; + return 20; end function GetItemIndex();virtual;//获得选中的序号 begin + return -1; end function SetItemIndex();virtual;//设置选中的序号 begin @@ -4250,6 +4290,14 @@ type TcustomComboBox=class(TCustomComboBoxbase) FEdit.Readonly := nv; end end + function getlistitemcount();override; //获得项目 + begin + return FListBox.ItemCount; + end + function getlistitemheight();override; //获得项目高 + begin + return FListBox.ItemHeight; + end function GetItemIndex();override; begin //if FMultisel and (csDesigning in ComponentState) then return -1; @@ -4602,8 +4650,7 @@ type TcustomToolBar=class(TCustomControl) **} function Create(AOwner);override; begin - inherited; - + inherited; end function AfterConstruction();override; begin @@ -4620,6 +4667,11 @@ type TcustomToolBar=class(TCustomControl) FTimer.Interval := 200; FTimer.Ontimer := thisfunction(DoTimerShowTip); end + function FontChanged(o);override; + begin + inherited; + if fmainmenu then doControlALign(); + end function MouseDown(o,e);override; begin if csDesigning in ComponentState then return; @@ -4867,21 +4919,29 @@ type TcustomToolBar=class(TCustomControl) begin if fmainmenu then begin - c.brush.Color := 0xe0e0e0; + c.brush.Color := 0xffffbb; c.FillRect(ci); end else c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONCHECK); end else begin - if bi.enabled then + if fmainmenu then begin - c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH); - end else - begin - c.brush.Color := 0x8c8c8c;////0xc0c0cc; + c.brush.Color := Color;////; c.FillRect(ci); - end + end + else + begin + if bi.enabled then + begin + c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH); + end else + begin + c.brush.Color := 0x8c8c8c;////0xc0c0cc; + c.FillRect(ci); + end + end end if fmainmenu then begin @@ -5072,11 +5132,7 @@ type TcustomToolBar=class(TCustomControl) InvalidateRect(nil,false); end end - function FontChanged(o);override; - begin - inherited; - if fmainmenu then doControlALign(); - end + private function mainmenuchanged(); begin @@ -5132,8 +5188,9 @@ type TcustomToolBar=class(TCustomControl) begin s := mu.Caption; wh := GetTextWidthAndHeightWidthFont(s,self.font,0);// wh - fmenubtnrects[i]:= array(x,y,x+wh[0]+5,rc[3]); - x:=x+wh[0]+15; + nwh := x+wh[0]+15; + fmenubtnrects[i]:= array(x,y,nwh,rc[3]); + x:=nwh; if x>rc[2] then break; //只有一行 end else begin diff --git a/funcext/tvclib/utslvcltree.tsf b/funcext/tvclib/utslvcltree.tsf index 7524820..eef8d14 100644 --- a/funcext/tvclib/utslvcltree.tsf +++ b/funcext/tvclib/utslvcltree.tsf @@ -1801,7 +1801,7 @@ type TcustomTreeCtl = class(TVirtualList) begin it.UnExpand(); end else - CallMessgeFunction(ondblclick,o,e); + CallMessgeFunction(ondblclick,o,e); end end function MouseUp(o,e);override;