微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

防止嵌套的 TeeChart 在设计时接收鼠标事件

如何解决防止嵌套的 TeeChart 在设计时接收鼠标事件

我使用嵌套的 TeeChart 制作了以下简单组件。没有更多内容了。

unit ExperimentalChart;

interface

uses System.Classes,Vcl.Controls,VclTee.TeeGDIPlus,VCLTee.TeEngine,VCLTee.TeeProcs,VCLTee.Chart;

type
  TExperimentalChart = class(TCustomControl)
  private
    FChart: TChart;
  protected
    procedure CreateHandle(); override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy(); override;
  published
  end;

procedure Register();

implementation

uses System.SysUtils;

procedure Register();
begin
  System.Classes.RegisterComponents('Experimental',[TExperimentalChart]);
end;

constructor TExperimentalChart.Create(AOwner: TComponent);
begin
  inherited;
  FChart := TChart.Create(nil);
  FChart.ClearChart();
  FChart.View3D := False;
end;

procedure TExperimentalChart.CreateHandle();
begin
  inherited;
  FChart.Parent := Self;
  FChart.Align := alClient;
end;

destructor TExperimentalChart.Destroy();
begin
  FreeAndNil(FChart);
  inherited;
end;

end.

当我在设计时使用这个组件并想在窗体上移动该组件时,TChart 接收到所有鼠标事件并出现一个错误框:

无法聚焦禁用或不可见的窗口。

堆栈跟踪:

main thread ($4b54):
50589ae6 +06e vcl190.bpl   Vcl.Forms       5675   +6 TCustomForm.SetActiveControl
50589bef +053 vcl190.bpl   Vcl.Forms       5716   +8 TCustomForm.FocusControl
5046a506 +012 vcl190.bpl   Vcl.Controls   12066   +3 TWinControl.SetFocus
42242810 +074 Tee9190.bpl  Vcltee                    Teeprocs.TCustomTeePanel.MouseDown
422a1be9 +025 Tee9190.bpl  Vcltee                    Chart.TCustomChart.MouseDown
5046318c +08c vcl190.bpl   Vcl.Controls    7363   +7 TControl.DoMouseDown
504631db +03f vcl190.bpl   Vcl.Controls    7374   +7 TControl.WMLButtonDown
50462b49 +2bd vcl190.bpl   Vcl.Controls    7224  +91 TControl.WndProc
50467669 +5c5 vcl190.bpl   Vcl.Controls   10039 +153 TWinControl.WndProc
422423a4 +00c Tee9190.bpl  Vcltee                    Teeprocs.TCustomTeePanel.WndProc
50466cac +02c vcl190.bpl   Vcl.Controls    9751   +3 TWinControl.MainWndProc
501749c4 +00c rtl190.bpl   System.Classes 17010   +5 StdWndProc
75bb3ebb +00b USER32.dll                             dispatchMessageW
50590dc3 +0f3 vcl190.bpl   Vcl.Forms      10288  +23 TApplication.ProcessMessage
50590e06 +00a vcl190.bpl   Vcl.Forms      10318   +1 TApplication.HandleMessage
50591141 +0c9 vcl190.bpl   Vcl.Forms      10456  +26 TApplication.Run
75916357 +017 KERNEL32.DLL                           BaseThreadInitThunk

如何禁止向图表传递事件并允许在设计时移动组件?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。