Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 

Re: Welcher Cursor ist gerade aktiv

  Alt 18. Jun 2007, 18:22
Zitat von marabu:
Hallo Emil,

den aktuell verwendeten Cursor solltest du jederzeit in Screen.Cursor finden - wenn ich mich nicht täusche.

Freundliche Grüße
Werde es mal testen.
Um was es mir geht bei dieser frage.

Ich möchte ein resize verhalten ala Winamp verwirklichen ohne extrem viele coordinaten abzufragen.
Meine Idee ist das über die abfrage des aktuell initialisierten cursor zu erreichen.

Dann benötige ich keine zusätzlichen coordinaten wo sich die Maus zur zeit befindet.
Ein Beispiel in VB habe ich schon geschrieben und es funktioniert mit ein paar zeilen.

Nur meine umsetzung von Vb nach Delphi macht wieder probleme.

Delphi-Quellcode:
Option Explicit

Private Sub ControlMouseMove(aCtrl As Object, Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim iTwipX, iTwipY
Dim iScale As Integer

    On Error Resume Next
        
        iScale = aCtrl.ScaleMode
        iTwipX = Screen.TwipsPerPixelX
        iTwipY = Screen.TwipsPerPixelY
        aCtrl.ScaleMode = 3

        If Button = vbLeftButton Then
            If MP = 0 Then GoTo Fix_Scale
            If MP = 7 Then GoTo NS_Resize

            If X / iTwipX > aCtrl.ScaleWidth + iTwipX Then
                aCtrl.Width = aCtrl.Width + iTwipX ^ 2 * 2
            ElseIf X / iTwipX < aCtrl.ScaleWidth - iTwipX Then
                aCtrl.Width = aCtrl.Width - iTwipX ^ 2 * 2
            End If
            Form1.Width = aCtrl.Left + aCtrl.Width
            aCtrl.Left = Form1.Width - 255
            If MP = 9 Then GoTo Fix_Scale
NS_Resize:

            If Y / iTwipY > aCtrl.ScaleHeight + iTwipY Then
                aCtrl.Height = aCtrl.Height + iTwipY ^ 2 * 2
            ElseIf Y / iTwipY < aCtrl.ScaleHeight - iTwipY Then
                aCtrl.Height = aCtrl.Height - iTwipY ^ 2 * 2
            End If
            Form1.Height = aCtrl.Top + aCtrl.Height
            aCtrl.Top = Form1.Height - 255
        Else
            If X / iTwipX > aCtrl.ScaleWidth - 12 _
               And Y / iTwipY > aCtrl.ScaleHeight - 10 Then
                MP = 8
            ElseIf X / iTwipX > aCtrl.ScaleWidth - 12 _
                   And Y / iTwipY < aCtrl.ScaleHeight - 10 Then
                MP = 9
            ElseIf X / iTwipX < aCtrl.ScaleWidth - 12 _
                   And Y / iTwipY > aCtrl.ScaleHeight - 10 Then
                MP = 7
            Else
                MP = 0
            End If
        End If
        Label1.Caption = CStr(MP)
Fix_Scale:
        aCtrl.ScaleMode = iScale%

End Sub

Private Sub Form_DblClick()

    Unload Me
    
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    MP = 0
    
End Sub

Private Property Let MP(aMPVal As Integer)

    Me.MousePointer = aMPVal

End Property

Private Property Get MP() As Integer

    MP = Me.MousePointer

End Property

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call ControlMouseMove(Picture1, Button, Shift, X, Y)

End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

    MP = 0

End Sub
gruss Emil
  Mit Zitat antworten Zitat