Click here to Skip to main content
14,695,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The rectangle displayed by drawreversibleframe is ok only the primary screen. If the form is on the other screen it is wrong. any idea ?

What I have tried:

Private Sub MyDrawReversibleRectangle(ByVal p1 As Point, ByVal p2 As Point, ByVal couleur As Color)
     Dim position As New Point

     position = p1

     ' Normalize the rectangle.
     If (p1.X < p2.X) Then
         donnees_lasso.rect.Width = p2.X - p1.X
     Else
         position.X = p2.X
         donnees_lasso.rect.Width = p1.X - p2.X
     End If

     If (p1.Y < p2.Y) Then
         donnees_lasso.rect.Height = p2.Y - p1.Y
     Else
         position.Y = p2.Y
         donnees_lasso.rect.Height = p1.Y - p2.Y
     End If

     donnees_lasso.rect.Location = position

     If True Then
         Dim position_form As Point = Me.PointToScreen(Me.XPanel_dessus.Location)
         donnees_lasso.rectangle_affiche.X = position.X + position_form.X
         donnees_lasso.rectangle_affiche.Y = position.Y + position_form.Y

     Else
         donnees_lasso.rectangle_affiche.Location = Me.PointToScreen(position)
     End If

     donnees_lasso.rectangle_affiche.Height = donnees_lasso.rect.Height
     donnees_lasso.rectangle_affiche.Width = donnees_lasso.rect.Width
     ControlPaint.DrawReversibleFrame(donnees_lasso.rectangle_affiche, couleur, FrameStyle.Dashed)


 End Sub
Posted
Comments
phil.o 23-May-20 18:12pm
   
Please define 'wrong'.
Member 11124009 24-May-20 3:23am
   
I mean that if I move the form on my secondary screen, the "drawreversibleframe" is made on the primary screen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900