设计器

修正label控件问题
This commit is contained in:
JianjunLiu 2023-05-29 10:46:56 +08:00
parent 2907d93dbf
commit e9f7ae4e50
3 changed files with 28 additions and 22 deletions

View File

@ -964,7 +964,7 @@ type TDVirutalWindow = class(TCustomControl) //
width := 30; width := 30;
height := 30; height := 30;
FWindowFileds := array("left","top","height","width"); FWindowFileds := array("left","top","height","width");
ParentFont := true; //ParentFont := true;
end end
function paint();override; function paint();override;
begin begin
@ -1464,7 +1464,7 @@ type TGraphicLabelWindow = class(TDVirutalWindow)
BindComp := new tlabel(self); BindComp := new tlabel(self);
width := BindComp.width; width := BindComp.width;
height := BindComp.Height; height := BindComp.Height;
WindowFileds := array("left","top","width","height","color","font","border","caption","visible","align","anchors"); WindowFileds := array("left","top","width","height","color","parentcolor","font","parentfont","border","caption","visible","align","anchors");
end end
function DesigningSizer();override; function DesigningSizer();override;

View File

@ -11,6 +11,7 @@ type TWinControl = class(tcontrol)
@explan(说明) 窗口控件 %% @explan(说明) 窗口控件 %%
**} **}
private //成员变量 private //成员变量
[weakref] ftrackmenu;
__wstyle; //窗口样式 __wstyle; //窗口样式
__wexstyle; //窗口扩展样式 __wexstyle; //窗口扩展样式
//__wstylestruct; //样式消息结构体 //__wstylestruct; //样式消息结构体
@ -970,15 +971,15 @@ type TWinControl = class(tcontrol)
end end
function WMMENURBUTTONUP(o,e):WM_MENURBUTTONUP;virtual; function WMMENURBUTTONUP(o,e):WM_MENURBUTTONUP;virtual;
begin begin
if PopupMenu is class({TcustomPopupmenu}TcustomMenu)then PopupMenu.dispatch(e); if PopupMenu and (PopupMenu is class(TcustomMenu))then PopupMenu.dispatch(e);
end end
function WMMENUSELECT(o,e):WM_MENUSELECT;virtual; function WMMENUSELECT(o,e):WM_MENUSELECT;virtual;
begin begin
if PopupMenu is class({TcustomPopupmenu}TcustomMenu)then PopupMenu.dispatch(e); if PopupMenu and (PopupMenu is class(TcustomMenu))then PopupMenu.dispatch(e);
end end
function WMINITMENUPOPUP(o,e):WM_INITMENUPOPUP;virtual; function WMINITMENUPOPUP(o,e):WM_INITMENUPOPUP;virtual;
begin begin
if PopupMenu is class({TcustomPopupmenu}TcustomMenu)then PopupMenu.dispatch(e); if PopupMenu and (PopupMenu is class(TcustomMenu))then PopupMenu.dispatch(e);
end end
function WMERASEBKGND(o,e):WM_ERASEBKGND;override; function WMERASEBKGND(o,e):WM_ERASEBKGND;override;
begin begin
@ -1031,7 +1032,7 @@ type TWinControl = class(tcontrol)
//dc := _wapi.GetDC(SELF.hANDLE); //dc := _wapi.GetDC(SELF.hANDLE);
//dcid := _wapi.SaveDC(dc); //dcid := _wapi.SaveDC(dc);
canvas.handle := dc; canvas.handle := dc;
if(e.wparam=0)and(PopupMenu is class({TcustomPopupmenu}TcustomMenu))then if(e.wparam=0)and(PopupMenu is class(TcustomMenu))then
begin begin
r := PopupMenu.dispatch(e); r := PopupMenu.dispatch(e);
if r then if r then
@ -1065,7 +1066,7 @@ type TWinControl = class(tcontrol)
@param(o)()控件本身 %% @param(o)()控件本身 %%
@param(e)(TMMEASUREITEM)测量消息 %% @param(e)(TMMEASUREITEM)测量消息 %%
**} **}
if(e.wparam=0 and e.ctltype=ODT_MENU)and(PopupMenu is class({TcustomPopupmenu}TcustomMenu))and PopupMenu.Dispatch(e)then exit; if(e.wparam=0 and e.ctltype=ODT_MENU)and(PopupMenu is class(TcustomMenu))and PopupMenu.Dispatch(e)then exit;
for i := 0 to FControls.count-1 do for i := 0 to FControls.count-1 do
begin begin
it := FControls[i]; it := FControls[i];
@ -1123,7 +1124,8 @@ type TWinControl = class(tcontrol)
end end
function WMCOMMAND(o,e):WM_COMMAND;virtual; function WMCOMMAND(o,e):WM_COMMAND;virtual;
begin begin
if(popupmenu is class({TcustomPopupmenu}TcustomMenu))and popupmenu.dispatch(e)then exit; if ftrackmenu and (ftrackmenu is class(TcustomMenu))and ftrackmenu.dispatch(e)then exit;
if PopupMenu and (popupmenu is class(TcustomMenu))and popupmenu.dispatch(e)then exit;
hd := e.lparam; hd := e.lparam;
if hd then if hd then
begin begin
@ -1913,21 +1915,24 @@ type TWinControl = class(tcontrol)
if factivated and factivecontrol and ContainsControl(factivecontrol) then factivecontrol.SetFocus(); if factivated and factivecontrol and ContainsControl(factivecontrol) then factivecontrol.SetFocus();
end end
end end
function TrackPopupMenu(x,y); //µ¯³ö²Ëµ¥ function TrackPopupMenu(mu,x,y); //µ¯³ö²Ëµ¥
begin begin
pp := PopupMenu; ftrackmenu := mu;
if HandleAllocated() and pp and pp.HandleAllocated() then if not(ifnumber(x) and ifnumber(y) ) then return 0;
if not(ftrackmenu and (ftrackmenu is class(TcustomMenu))) then return 0;
if HandleAllocated() then
begin begin
xy := ClientToScreen(x,y); xy := ClientToScreen(x,y);
uf := TPM_LEFTALIGN .| TPM_TOPALIGN .| TPM_RIGHTBUTTON; uf := TPM_LEFTALIGN .| TPM_TOPALIGN .| TPM_RIGHTBUTTON;
_wapi.TrackPopupMenu(PopupMenu.Handle,uf,xy[0],xy[1],0,self.Handle,nil); _wapi.TrackPopupMenu(ftrackmenu.Handle,uf,xy[0],xy[1],0,self.Handle,nil);
end end
end end
function Notification(ac,op);override; function Notification(ac,op);override;
begin begin
if op=opRecycling and ac=factivecontrol then if op=opRecycling then
begin begin
factivecontrol := nil; if ac = factivecontrol then factivecontrol := nil;
if ac = ftrackmenu then ftrackmenu := nil;
end end
inherited; inherited;
end end

View File

@ -58,15 +58,15 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
if FScroolChanged then if FScroolChanged then
begin begin
FScroolChanged := false; FScroolChanged := false;
UpDateScrollBar(); DoControlAlign();//UpDateScrollBar();
end end
end end
inherited; inherited;
end end
function UpDateScrollBar(); // function UpDateScrollBar();
begin // begin
DoControlAlign(); // DoControlAlign();
end // end
function DoControlAlign();override; function DoControlAlign();override;
begin begin
if(IsUpDating())then if(IsUpDating())then
@ -241,7 +241,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
function hititemat(xy); //命中 function hititemat(xy); //命中
begin begin
r := array(); r := array();
if (ifarray(xy) and ifnumber(xy[0]) and ifnumber(xy[1])) then return r; if not(ifarray(xy) and ifnumber(xy[0]) and ifnumber(xy[1])) then return r;
x := xy[0]; x := xy[0];
y := xy[1]; y := xy[1];
ri := GetRowIndexByPos(y); ri := GetRowIndexByPos(y);
@ -788,6 +788,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
property mergeinfo:tsl read GetMergeInfo write setmergeinfo; property mergeinfo:tsl read GetMergeInfo write setmergeinfo;
property ColumnWidth read GetColumnWidth write SetColumnWidth; property ColumnWidth read GetColumnWidth write SetColumnWidth;
property rowheight read GetRowHeight write UpDateRowWidth; property rowheight read GetRowHeight write UpDateRowWidth;
property topline:lazyinteger read GetYPos write SetYpos;
{** {**
@param(ItemCount)(integer) 行数 %% @param(ItemCount)(integer) 行数 %%
@param(ColumnCount)(integer) 列数 %% @param(ColumnCount)(integer) 列数 %%
@ -1111,8 +1112,8 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
fselend; fselend;
fselbkcolor; fselbkcolor;
// //
Fondrawcell; [weakref]Fondrawcell;
fonhitcellsizer; [weakref]fonhitcellsizer;
fmouseleftdown; fmouseleftdown;
fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽 fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽
FScroolChanged; FScroolChanged;