diff --git a/funcext/tvclib/tcontrol.tsf b/funcext/tvclib/tcontrol.tsf index 3c2063f..3c92b18 100644 --- a/funcext/tvclib/tcontrol.tsf +++ b/funcext/tvclib/tcontrol.tsf @@ -195,6 +195,7 @@ type tcontrol = class(tcomponent) if FParentFont <> nv then begin FParentFont := nv; + FontChanged(); return 1; end end @@ -352,16 +353,16 @@ type tcontrol = class(tcomponent) protected //部分属性设置 function GetControlFont();virtual; begin - if ParentFont and Parent then return Parent.FFont; + if ParentFont and Parent then return Parent.font; return FFont; end function SetControlFont(v);virtual; begin + if ParentFont then return ; //如果使用父节点的字体,那么字体无效 if ifarray(v)then begin FFont.SetValues(v); end else - //if v is class(tfont)then if v is class(Tcustomfont)then begin FFont.copyfont(v); @@ -497,6 +498,7 @@ type tcontrol = class(tcomponent) {** @explan(说明) 子控件添加 %% **} + if AControl and AControl.ParentFont then AControl.FontChanged(); end function ControlDeleted(AControl);virtual;//子控件被删除 begin @@ -676,7 +678,7 @@ type tcontrol = class(tcomponent) end; procedure FontChanged(Sender:TObject);virtual; begin - if parent then parent.FontChanged(Sender); + //if parent then parent.FontChanged(Sender); end function GetClientRect();virtual; // //type_tcontrol visual size of client area begin diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index 1e69c11..b38f2d5 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -988,6 +988,7 @@ type TVCForm = class(TScrollingWinControl) end procedure FontChanged(Sender:TObject);override; begin + return inherited; if(HandleAllocated())then begin _send_(WM_SETFONT,Font.Handle,1); diff --git a/funcext/tvclib/twincontrol.tsf b/funcext/tvclib/twincontrol.tsf index f90a419..f21b02a 100644 --- a/funcext/tvclib/twincontrol.tsf +++ b/funcext/tvclib/twincontrol.tsf @@ -793,17 +793,23 @@ type TWinControl = class(tcontrol) end procedure FontChanged(Sender:TObject);override; begin - if(HandleAllocated()and not(ParentFont))then + for i := 0 to ControlCount-1 do begin - _send_(WM_SETFONT,Font.Handle,1); - end + it := Controls[i]; + if it.ParentFont then + begin + it.FontChanged(sender); + end + //InvalidateRect(nil,false); + //it.Perform(new tuieventbase(CM_PARENTFONTCHANGED,hd,1,0)); + end end function CMPARENTFONTCHANGED(o,e):CM_PARENTFONTCHANGED;virtual; begin - if ParentFont then - begin - _send_(WM_SETFONT,e.wparam,1); - end + //if ParentFont then + //begin + // _send_(WM_SETFONT,e.wparam,1); + //end end function WMGETMINMAXINFO(o,e):WM_GETMINMAXINFO;virtual; begin @@ -850,8 +856,8 @@ type TWinControl = class(tcontrol) end function WMSETFONT(o,e):WM_SETFONT;virtual; begin - defaulthandler(e); - Perform(new tuieventbase(CM_FONTCHANGED,e.wparam,e.lparam,0)); + //defaulthandler(e); + //Perform(new tuieventbase(CM_FONTCHANGED,e.wparam,e.lparam,0)); end function WMACTIVATE(o,e):WM_ACTIVATE;virtual; begin diff --git a/funcext/tvclib/utslvclgdi.tsf b/funcext/tvclib/utslvclgdi.tsf index d4e8ee6..688ca02 100644 --- a/funcext/tvclib/utslvclgdi.tsf +++ b/funcext/tvclib/utslvclgdi.tsf @@ -11,7 +11,7 @@ function GetGdipStatus(v); type TGdi = class(TSLUIBASE) private static GDICache; - FCanvas; + [weakref]FCanvas; function SetCanvas(c); begin FCanvas := c; @@ -428,10 +428,11 @@ type Tcustomfont = class(tgdi) end end end - if ifnumber(vs["color"])then + vsc := vs["color"]; + if ifnumber(vsc) and (FColor<>vsc) then begin cg := true; - SetColor(vs["color"]); + SetColor(vsc); end if cg then Onchange(); return cg; @@ -464,7 +465,7 @@ type TFontControl=class(Tcustomfont) @explan(说明) 控件字体 %% **} private - FControl; + [weakref]FControl; Function SetControl(v); begin if(v <> FControl)and(v is class(tcontrol))then diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index 273128b..ec6d4e4 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -2959,8 +2959,9 @@ type tthreeEntry=class(TCustomControl) function FontChanged(o);override; begin //改变 - FFontWidth := font.width; - for i,v in FEntrys do v.Font := font; + ft := font; + FFontWidth := ft.width; + for i,v in FEntrys do v.Font := ft; calcCtls(); end protected @@ -3237,14 +3238,16 @@ type TCustomListBoxbase=class(TCustomScrollControl) end function FontChanged(o);override; begin - wd := font.width; - h := font.Height; + ft := Font; + wd := ft.width; + h := ft.Height; if h <> FFontHeight or wd <> FFontWidth then begin FFontHeight := h; FFontWidth := wd; UpDateScrollBar(); end + inherited; end function GetItemCount();virtual; begin @@ -4102,7 +4105,7 @@ type TCustomComboBoxbase=class(TCustomControl) end published property itemcount read GetItemCount ; - property ItemIndex:tsl read GetItemIndex write SetItemIndex; + property ItemIndex:lazytsl read GetItemIndex write SetItemIndex; property OnSelchanged:eventhandler read FOnSelchanged write FOnSelchanged; property ondropdown:eventhandler read Fondropdown write Fondropdown; property oncloseup:eventhandler read Foncloseup write Foncloseup; @@ -4294,10 +4297,12 @@ type TcustomComboBox=class(TCustomComboBoxbase) FEdit.Readonly := Freadonly; FListBox.parent := self; FEdit.parent := self; + FEdit.ParentFont := true; end function CreateAlist();override; begin r := new TComboListBox(self); + r.ParentFont := true; return r; end function SetDesigning(Value,SetChildren);override; @@ -6013,6 +6018,7 @@ type tcustomgroupbox=class(TCustomControl) wf := ft.width; hf := ft.height+2; cvs := Canvas; + cvs.font := ft; cvs.pen.color := 11184810;//rgb(170,170,170); cvs.pen.width := 1; cwd := 0;