Autor Beitrag
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mo 28.03.05 20:24 
Hi,

Ich soch eine Möglichkeit die Position des Cursors auf dem gesammten Bildschirm, anzeigen zu lassen. Ich habe gesucht aber nichts dementsprechendes gefunden falls es aber doch so einen Thread gibt (wo ich mir eigentlich sicher bin) wäre ich geren draufhingewiesen.


Edit: Komma eingefügt da's sonst missverständlich wird.


Moderiert von user profile iconraziel: Topic aus Sonstiges verschoben am Di 29.03.2005 um 08:05
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: Mo 28.03.05 20:28 
Die Cursorposition liest man so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var
  p: TPoint;
begin
  GetCursorPos(p)
end;
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mo 28.03.05 20:32 
Und wie würde ich diese dan in zb einem Label anzeigen lassen??
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 28.03.05 20:41 
gib in die delphi hilfe TPoint ein, dann bekommst du folgendes:
Delphi Onlinehilfe hat folgendes geschrieben:

Der Typ TPoint definiert eine Pixel-Position auf dem Bildschirm.

Unit

Types

Delphi-Syntax:

type TPoint = packed record
X: Longint;
Y: Longint;
end;

C++ Syntax:

struct TPoint

{
TPoint() {}
TPoint(int _x, int _y) : x(_x), y(_y) {}
TPoint(POINT& pt)
{
x = pt.x;
y = pt.y;
}
operator POINT() const
{
POINT pt;
pt.x = x;
pt.y = y;
return pt;
}
int x;
int y;

};

Beschreibung

Der Typ TPoint definiert eine Pixel-Position auf dem Bildschirm. Der Ursprung liegt in der linken oberen Ecke. X steht für die horizontale Koordinate, Y für die vertikale.

das bedeutet: du kannst auf die x- und yposition zugreifen in dem du machst:
ausblenden Delphi-Quelltext
1:
aTPoint.x {und} aTPoint.y					

dadurch erhälst du 2 Longint-werte, die du wie jeden anderen Integerwert umwandeln kannst in einen String:
ausblenden Delphi-Quelltext
1:
Label1.Caption:=IntToStr(aTPoint.x);					

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Di 29.03.05 07:34 
Sehr gut. Genau das hab ich gesucht.

Danke :D