5 Replies - 285 Views - Last Post: 14 January 2013 - 04:34 AM Rate Topic: -----

#1 Moopf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-January 13

Option Strict Problem Point to Size

Posted 13 January 2013 - 11:14 PM

Dim temp As Point = New Point(Me.Location + (e.Location - MousePos))



Errormessage:

Fehler 2 Fehler bei der Überladungsauflösung, da keine zugreifbare "-" mit diesen Argumenten aufgerufen werden kann:
"Public Shared Operator -(pt As System.Drawing.Point, sz As System.Drawing.Size) As System.Drawing.Point": "Option Strict On" lässt keine impliziten Konvertierungen von System.Drawing.Point in System.Drawing.Size zu. <User_Path>

This post has been edited by macosxnerd101: 13 January 2013 - 11:25 PM
Reason for edit:: Removed full path per user request


Is This A Good Question/Topic? 0
  • +

Replies To: Option Strict Problem Point to Size

#2 kai_itz me  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 159
  • Joined: 03-August 12

Re: Option Strict Problem Point to Size

Posted 13 January 2013 - 11:26 PM

WHAT U WANT TO DO WITH YOUR CODE ?

IT CANNOT READ YOUR ERROR MESSAGE .. CAN U PLESE WRITE THIS IN ENGLISH
Was This Post Helpful? 0
  • +
  • -

#3 Moopf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-January 13

Re: Option Strict Problem Point to Size

Posted 13 January 2013 - 11:31 PM

Errormessage (Sorry Google translation):

Error 2 error in overload resolution, because no accessible '-' can be called with these arguments:
"Public Shared Operator - (pt As System.Drawing.Point, sz As System.Drawing.Size) As System.Drawing.Point": "Option Strict On" makes no implicit conversions from System.Drawing.Point in System.Drawing. Size about. <User_Path>



This error happens when Option strict on.

here is the code i use:

http://www.dreaminco...post__p__396179

everything works fine when i disable "option strict on"


thanks moopf
Was This Post Helpful? 0
  • +
  • -

#4 kai_itz me  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 159
  • Joined: 03-August 12

Re: Option Strict Problem Point to Size

Posted 13 January 2013 - 11:50 PM

IF U ARE TRYING TO DRAG YOUR FORM WITH MOUSE SO THIS CODE IS WORKING PERFECT

Public Class Form5




    Dim IsDraggingForm As Boolean = False

    Private MousePos As New System.Drawing.Point(0, 0)



    Private Sub Form5_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown

        If e.Button = MouseButtons.Left Then

            IsDraggingForm = True

            MousePos = e.Location

        End If

    End Sub



    Private Sub Form5_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp

        If e.Button = MouseButtons.Left Then IsDraggingForm = False

    End Sub



    Private Sub Form5_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove

        If IsDraggingForm Then

            Dim temp As Point = New Point(Me.Location + (e.Location - MousePos))

            Me.Location = temp
            temp = Nothing
        End If

    End Sub


End Class

Was This Post Helpful? 0
  • +
  • -

#5 Moopf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-January 13

Re: Option Strict Problem Point to Size

Posted 13 January 2013 - 11:55 PM

if you're adding "Option strict on" at the top you're still getting an error.

Dim temp As Point = New Point(Me.Location + (e.Location - MousePos))

at least here in my project
Was This Post Helpful? 0
  • +
  • -

#6 kai_itz me  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 159
  • Joined: 03-August 12

Re: Option Strict Problem Point to Size

Posted 14 January 2013 - 04:34 AM

use this..i made some changes

Option Strict On

Imports System
Imports System.Data
Imports System.Drawing.Point
Imports System.Drawing.Size

Public Class Form5

 Dim MouseIsDown As Boolean = False
    Dim MouseIsDownLoc As Point = Nothing

 Private Sub Form5_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp
        MouseIsDown = False
end sub

 Private Sub Form5_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove

        If e.Button = MouseButtons.Left Then
            If MouseIsDown = False Then
                MouseIsDown = True
                MouseIsDownLoc = New Point(e.X, e.Y)
            End If

            Me.Location = New Point(Me.Location.X + e.X - MouseIsDownLoc.X, Me.Location.Y + e.Y - MouseIsDownLoc.Y)
        End If
end sub
end class


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1