Bonjour, après beaucoup de tentatives je n'ai pas réussi a changer le région selector.
Mon problème : je ne peux que sélectionner d'en haut a droite vers le bas-droite alors que je veux pouvoir le faire dans n'importe quel sens/direction.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Imports System.Runtime.InteropServices
 
Public Class frmSS
    Private Declare Auto Function BitBlt Lib "gdi32.dll" ( _
     ByVal hdcDest As IntPtr, _
     ByVal nXDest As Integer, _
     ByVal nYDest As Integer, _
     ByVal nWidth As Integer, _
     ByVal nHeight As Integer, _
     ByVal hdcSrc As IntPtr, _
     ByVal nXSrc As Integer, _
     ByVal nYSrc As Integer, _
     ByVal dwRop As Int32) As Boolean
    <DllImport("user32.dll")> _
    Public Shared Function GetAsyncKeyState(ByVal vKey As Int32) As Short
    End Function
    Private Declare Auto Function GetDC Lib "user32.dll" (ByVal hWnd As IntPtr) As IntPtr
    Private Declare Auto Function ReleaseDC Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As IntPtr
 
    Private Sub frmSS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 1
        Timer1.Enabled = True
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        Me.Location = New Point(0, 0)
        Me.ClientSize = Screen.GetBounds(Me).Size
        Me.BackColor = Color.Gray
        Me.DoubleBuffered = True
        Me.Opacity = 0.4#
        Me.Cursor = Cursors.Cross
        Me.ShowInTaskbar = False
    End Sub
 
    Private isDragging As Boolean = False
    Private canDrag As Boolean = True
    Private pt_start As Point = Point.Empty
    Private pt_end As Point = Point.Empty
 
    Private Sub frmSS_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        If Me.canDrag Then
            Me.isDragging = True
            Me.pt_start = e.Location
        End If
        If e.Button = MouseButtons.Right Then
            If Me.isDragging = True Then
                Me.isDragging = False
                Me.pt_start = e.Location
                Me.pt_end = e.Location
                Me.Hide()
                Me.Show()
            End If
        End If
    End Sub
 
    Private Sub frmSS_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        If Me.isDragging Then
            Me.pt_end = e.Location
            Me.Invalidate()
        End If
    End Sub
 
    Private Sub frmSS_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        If Me.isDragging Then
            Me.isDragging = False
            Me.canDrag = False
            Me.Cursor = Cursors.Default
            Dim r As Rectangle = Me.SelectedRectangle
            Me.Hide()
            Application.DoEvents() 'Make sure everything's good and hidden.
            Me.CaptureThisArea(r)
            Me.Close()
        End If
    End Sub
 
    Private ReadOnly Property SelectedRectangle() As Rectangle
        Get
            With pt_start
                If .X >= pt_end.X OrElse .Y >= pt_end.Y Then Return Rectangle.Empty
                Return New Rectangle(.X, .Y, pt_end.X - .X, pt_end.Y - .Y)
            End With
        End Get
    End Property
 
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
 
        Using p As New Pen(Color.Black, 3)
            p.DashStyle = Drawing2D.DashStyle.Dash
            If Me.SelectedRectangle <> Rectangle.Empty Then
                e.Graphics.FillRectangle(Brushes.Cyan, Me.SelectedRectangle)
                e.Graphics.DrawRectangle(New Pen(Color.Black, 3), Me.SelectedRectangle)
            End If
 
        End Using
 
        MyBase.OnPaint(e)
    End Sub
Quelqu'un aurait une idée svp ?