Advertisement

05.19.2008 at 10:05PM PDT, ID: 23416078
[x]
Attachment Details

MouseDown Event

Asked by heromed in Graphics and Delphi Programming

Tags: Borland, Derlphi, 6.2

I needed a TImage Component with a border, so I created the following:
-------------------------------------------------------------------------------------------------------------------------

unit MyImage;
 
interface

uses
  SysUtils, Classes, Controls, ExtCtrls, StdCtrls,ExtDlgs,Forms,Graphics;
 
type
  TMyImage = class(TPanel)
  private
    { Private declarations }

    FImage: TImage;
    function GetPicture:TPicture;
    procedure SetPicture(Value : TPicture);
  protected
    { Protected declarations }
 
  public
    constructor Create(AOwner : TComponent); override;
    destructor Destroy; override;
    { Public declarations }
  published
    { Published declarations }
    property Picture : TPicture read GetPicture write SetPicture;
  end;
 
procedure Register;
 
implementation
 
procedure Register;
begin
  RegisterComponents('Bobs', [TMyImage]);
end;

constructor TMyImage.Create(AOwner : TComponent);
begin
  inherited Create(AOwner);
  Caption := ' ';
  BevelInner := bvNone;
  BevelOuter := bvNone;
  BorderStyle := bsSingle;
  BorderWidth := 1;
  Ctl3D := False;
  SetBounds(Left,Top,200,200);

  FImage := TImage.Create(Self);
  FImage.Parent := Self;
  FImage.Align := alClient;
  FImage.Anchors := [akLeft,akTop,akRight,akBottom];
  FImage.Stretch := True;
end;

destructor TMyImage.Destroy;
begin
  FImage.Free;
  inherited;
end;


function TMyImage.GetPicture : TPicture;
begin
  Result := FImage.Picture;
end;
 
procedure TMyImage.SetPicture(Value : TPicture);
begin
   FImage.Picture.Assign(Value);
end;
 
---------------------------------------------------------------------------------------------------------

I would like to implement a MouseDown event for the Image subcomponent.

How do I do that ?
end.Start Free Trial
[+][-]05.19.2008 at 11:44PM PDT, ID: 21603960

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 03:07AM PDT, ID: 21604681

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 06:06AM PDT, ID: 21605716

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Graphics and Delphi Programming
Tags: Borland, Derlphi, 6.2
Sign Up Now!
Solution Provided By: MerijnB
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.20.2008 at 02:25PM PDT, ID: 21610505

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 03:17PM PDT, ID: 21610847

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:14AM PDT, ID: 21612709

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 09:59PM PDT, ID: 21621008

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628