Question : mouse click on image of TcxPageControl (Tab image)

Hi there,

i'm looking to find (in a onmousedown) a check to see if the mouse pointer is over the image of the tab of a pagecontrol

The TcxPageControl is a devexpress component
Component code:
var
  pcSUMDatabases: TcxPageControl;
  cxTabSheet1: TcxTabSheet;

  pcSUMDatabases := TcxPageControl.Create(Self);
  cxTabSheet1 := TcxTabSheet.Create(Self);
  with pcSUMDatabases do
  begin
    Name := 'pcSUMDatabases';
    Parent := tsSUM;
    Left := 0;
    Top := 105;
    Width := 971;
    Height := 431;
    ActivePage := cxTabSheet1;
    Align := alClient;
    ImageBorder := 2;
    Images := ilTabs;
    Options := [pcoAlwaysShowGoDialogButton, pcoGoDialog, pcoGradient, pcoGradientClientArea, pcoRedrawOnResize];
    Style := 9;
    TabOrder := 1;
    OnMouseDown := pcSUMDatabasesMouseDown;
  end;
  with cxTabSheet1 do
  begin
    Name := 'cxTabSheet1';
    Parent := pcSUMDatabases;
    Caption := 'cxTabSheet1';
    ImageIndex := 0;
  end;

(dfm paste code)
object pcSUMDatabases: TcxPageControl
  Left = 0
  Top = 105
  Width = 971
  Height = 431
  ActivePage = cxTabSheet1
  Align = alClient
  ImageBorder = 2
  Images = ilTabs
  LookAndFeel.Kind = lfStandard
  Options = [pcoAlwaysShowGoDialogButton, pcoGoDialog, pcoGradient, pcoGradientClientArea, pcoRedrawOnResize]
  Style = 9
  TabOrder = 1
  TabSlants.Positions = [spLeft, spRight]
  OnMouseDown = pcSUMDatabasesMouseDown
  ExplicitLeft = 96
  ExplicitTop = 224
  ExplicitWidth = 289
  ExplicitHeight = 193
  ClientRectBottom = 431
  ClientRectRight = 971
  ClientRectTop = 26
  object cxTabSheet1: TcxTabSheet
    Caption = 'cxTabSheet1'
    ImageIndex = 0
  end
end


The ilTabs contains images from the common files (buttons dir) 16x16

I just can't seem to find how to find the location of the image on the tab.

Anybody a solution of ideas ?

i'll add a screenshot to explain what area i'm exactly looking for

Answer : mouse click on image of TcxPageControl (Tab image)

got it:

in the hidden depths of the protected painters:

type
  TmagiccxPCStandardPainter = class(TcxPCStandardPainter) end;

procedure TfrmSumGraphs.pcSUMDatabasesMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  n: Integer;
  tab: tcxTabSheet;
  R: TRect;
  pt: TPoint;
begin
  n := pcSUMDatabases.IndexOfTabAt(X, Y);
  if (n <> -1) then
  begin
    tab := pcSUMDatabases.Pages[n];
    TmagiccxPCStandardPainter(pcSUMDatabases.Painter).StandardPainterPrepareOutTabImageAndTextData(tab.TabIndex);
    R := TmagiccxPCStandardPainter(pcSUMDatabases.Painter).FOutTabImageAndTextData.TabImageRect;
    if PtInRect(R, Point(X, Y)) then ShowMessage('It''s on the image !!!!');
  end;
end;
Random Solutions  
 
programming4us programming4us