设计器

修正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;
height := 30;
FWindowFileds := array("left","top","height","width");
ParentFont := true;
//ParentFont := true;
end
function paint();override;
begin
@ -1464,7 +1464,7 @@ type TGraphicLabelWindow = class(TDVirutalWindow)
BindComp := new tlabel(self);
width := BindComp.width;
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
function DesigningSizer();override;

View File

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

View File

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