Autor Beitrag
delphisual
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

WIN 2000
D5 Prof
BeitragVerfasst: Sa 20.09.03 17:03 
Hallo zusammen,

ich möchte über MouseDown Event die Farbe des Pixels herausfinden auf dem ich die Maustaste drücke.
Ich freue mich auf jede Antwort, danke schön!

Mit freundlichen Grüßen
delphisual

_________________
(Wer ein Problem definiert, hat es schon halb gelöst.)
delphisual Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

WIN 2000
D5 Prof
BeitragVerfasst: Sa 20.09.03 17:43 
Hallo nochmals, hier ist mein Code,

sieht jemand meinen Fehler?


ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    Timer1: TTimer;
    Image1: TImage;
    procedure Timer1Timer(Sender: TObject);
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  x1,y1:integer;
  Farbe: TColor;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Form1.Label1.Caption:=IntToStr(x1)+'  '+IntToStr(y1);;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
X1:=X;
Y1:=Y;
Farbe:=Image1.Canvas.Pixels[X,Y];
Form1.label1.Color:=Farbe;
end;

end.



Mit freundlichen Grüßen
delphisual

_________________
(Wer ein Problem definiert, hat es schon halb gelöst.)
delphisual Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

WIN 2000
D5 Prof
BeitragVerfasst: Sa 20.09.03 17:51 
Hallo wieder, war ein dummer Fehler.
So klappt es:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
Form1.Label1.Caption:=IntToStr(x)+'  '+IntToStr(y);;
Farbe:=Image1.Canvas.Pixels[X,Y];
Form1.label1.Color:=Farbe;
end;

_________________
(Wer ein Problem definiert, hat es schon halb gelöst.)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 20.09.03 17:53 
Hallo!

Versuch mal das MouseMove-Ereignis des Image1 zu benutzen.

MfG
Peter

//edit: Ups, Antwortformular zu lange offen gelassen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".