Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi:更改TJvDockTabHostForm的选项卡图标_Delphi_Jedi_Jvcl - Fatal编程技术网

Delphi:更改TJvDockTabHostForm的选项卡图标

Delphi:更改TJvDockTabHostForm的选项卡图标,delphi,jedi,jvcl,Delphi,Jedi,Jvcl,设置TJvDockVSPopupPanel后,是否有方法更改其选项卡图标 问题是,我想在我的程序通过更改后将选项卡图标更改为验证图像 ImageList1: TImageList; procedure TValidationWindow.UpdateIcon; var i, topValidationError : integer; begin topValidationError := 3; { SECTION //Set topV

设置TJvDockVSPopupPanel后,是否有方法更改其选项卡图标

问题是,我想在我的程序通过更改后将选项卡图标更改为验证图像

ImageList1: TImageList;

procedure TValidationWindow.UpdateIcon;
var
    i, topValidationError  : integer;
begin
    topValidationError := 3;

    {
        SECTION
        //Set topValidationError value to the specific error that has occurred
        SECTION END
    }

    // Set the Icon to the specific image.
    ImageList1.GetIcon(topValidationError, Self.Icon);
end;
以上仅在第一次使用时有效!有什么想法吗

编辑:

进一步检查后,我发现TJvDockCustomTabControl中有一个FImages:TCustomImageList,但是我还没有找到访问FImages的方法,我假设必须有某种方法将我的图标添加到此列表中,然后使用imageindex更改选项卡图标图像

已解决:


因此,最大的问题是访问图像列表,这可以通过TJvDockVIDTabPageControl完成,它允许访问TJVDockTabControl

更改选项卡图标的代码是

if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        if FTabSheetIndex = - 1 then
            FTabSheetIndex := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).PageSheets.IndexOf(TJvDockTabSheet(Self.Parent));
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Pages[FTabSheetIndex].ImageIndex := x// The icon you want to use
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Panel.Refresh;
    end;
if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        if FTabSheetIndex = - 1 then
            FTabSheetIndex := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).PageSheets.IndexOf(TJvDockTabSheet(Self.Parent));
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Pages[FTabSheetIndex].ImageIndex := x// The icon you want to use
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Panel.Refresh;
    end;
我加入了FTabSheetIndex,因为对DockHost窗口的更改可能会导致选项卡更改,例如,在更改选项卡之前删除选项卡将导致选项卡索引顺序更改,因此可以轻松地将其设置为-1并再次找到

可以在此处找到有关GetOrients()的信息

您还必须将图标添加到TJvDockTabPageControl,最好在FormShow事件中完成

if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        FTabImageListCount := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.Count;
        for i := 0 to ImageList1.Count - 1 do
        begin
            ImageList1.GetIcon(i,Icon);
            ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.AddIcon(icon);
        end;
    end;
if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        FTabImageListCount := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.Count;
        for i := 0 to ImageList1.Count - 1 do
        begin
            ImageList1.GetIcon(i,Icon);
            ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.AddIcon(icon);
        end;
    end;

但是,如果表单未在应用程序开始时显示,则图标更改功能可能无法工作,直到您专门单击选项卡以显示它。因此,最好在表单添加到TJvDockHostForm后立即添加图标。。。这仍然是我正在研究的问题,但是关键问题已经解决。

所以最大的问题是访问图像列表,这可以通过允许访问TJvDockVIDTabPageControl的TJvDockVIDTabPageControl来完成

更改选项卡图标的代码是

if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        if FTabSheetIndex = - 1 then
            FTabSheetIndex := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).PageSheets.IndexOf(TJvDockTabSheet(Self.Parent));
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Pages[FTabSheetIndex].ImageIndex := x// The icon you want to use
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Panel.Refresh;
    end;
if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        if FTabSheetIndex = - 1 then
            FTabSheetIndex := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).PageSheets.IndexOf(TJvDockTabSheet(Self.Parent));
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Pages[FTabSheetIndex].ImageIndex := x// The icon you want to use
        ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Panel.Refresh;
    end;
我加入了FTabSheetIndex,因为对DockHost窗口的更改可能会导致选项卡更改,例如,在更改选项卡之前删除选项卡将导致选项卡索引顺序更改,因此可以轻松地将其设置为-1并再次找到

可以在此处找到有关GetOrients()的信息

您还必须将图标添加到TJvDockTabPageControl,最好在FormShow事件中完成

if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        FTabImageListCount := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.Count;
        for i := 0 to ImageList1.Count - 1 do
        begin
            ImageList1.GetIcon(i,Icon);
            ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.AddIcon(icon);
        end;
    end;
if (GetAncestors(Self, 3) is TJvDockTabHostForm) then
    if ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl is TJvDockVIDTabPageControl) then
    begin
        FTabImageListCount := ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.Count;
        for i := 0 to ImageList1.Count - 1 do
        begin
            ImageList1.GetIcon(i,Icon);
            ((GetAncestors(Self, 3) as TjvDockTabHostForm).PageControl as TJvDockVIDTabPageControl).Images.AddIcon(icon);
        end;
    end;

但是,如果表单未在应用程序开始时显示,则图标更改功能可能无法工作,直到您专门单击选项卡以显示它。因此,最好在表单添加到TJvDockHostForm后立即添加图标。。。这仍然是我正在研究的问题,但是关键问题已经解决。

FImages:TCustomImageList
听起来像是通过
Images
属性公开的东西。控件是否有一对
图像
图像索引
属性?这将是标准的,如果是的话,就使用它们。不幸的是,不是在那门课上,我今天早上找到了一个解决方案,我整理好这些信息后会发布:)