小编Fra*_*ndt的帖子

Delphi组件设计 - 从子属性中获取组件的属性

我正在制作一个Delphi vcl组件,组件类有一个'images'属性,可以让我选择一个TImagelist.

组件类还有一个子属性"按钮",它本身具有imageindex属性.

我已经为imageindex属性编写了一个组件编辑器,以便我可以从图像列表中选择按钮上的图像; 我以前在其他组件中做过这个,但我现在面临的问题是我需要从'buttons'子类事件中的事件中获取基类的images属性.

因此,组件的基类具有以下属性:

property Buttons: TFlexButtons read FButtons write FButtons;
property Images: TCustomImageList read FImages write SetImages;
Run Code Online (Sandbox Code Playgroud)

buttons类具有以下属性:

property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
Run Code Online (Sandbox Code Playgroud)

我在ImageIndex属性的单独单元中注册一个属性编辑器,以便选择一个图像但是在这个事件中我需要从组件的基类中获取图像列表,我如何从这个子属性获得这个属性?

function TImageIndexProperty.GetImageListAt(Index: Integer): TCustomImageList;
var APersistent: TPersistent;
begin
  APersistent := GetComponent(Index);
  if APersistent is TFlexButton then
    Result := ??????????.Images //how do i refer to the images property of the component here?
  else
    Result := nil;
end;
Run Code Online (Sandbox Code Playgroud)

所有课程:

TFlexButton = class(TCollectionItem)
private
  FWidth: Word;
  FCaption: string;
  FHeight: Word;
  FImageIndex: TImageIndex; …
Run Code Online (Sandbox Code Playgroud)

delphi components imagelist

5
推荐指数
1
解决办法
586
查看次数

如何处理Synedit表名上的链接?

我正在使用Delphi中的TSynEdit编写Sql编辑器.我在荧光笔和自动填充的表名中有我的对象名称(表格,存储过程,域等),它们以蓝色和下划线显示这是我想要的但我想知道我是否可以将这些链接到一个事件我实际上可以打开那个对象.

有办法吗?

a)当鼠标悬停在这样的关键字上时,将光标更改为handPoint?

b)点击这样的关键字时执行事件,程序,功能?

谢谢你的建议.

在此输入图像描述

delphi synedit

4
推荐指数
1
解决办法
167
查看次数

标签 统计

delphi ×2

components ×1

imagelist ×1

synedit ×1