Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error

Error

Scheduled Pinned Locked Moved C#
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shamsteady
    wrote on last edited by
    #1

    There are error to compile this code because panel3.left and panel3.top are not defined in the class. How to overcome this? protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove (e); if (isDragging3 == true) { panel3.Left = e.X + panel3.Left - x3; panel3.Top = e.Y + panel3.Top - y3; } }

    C M 2 Replies Last reply
    0
    • S shamsteady

      There are error to compile this code because panel3.left and panel3.top are not defined in the class. How to overcome this? protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove (e); if (isDragging3 == true) { panel3.Left = e.X + panel3.Left - x3; panel3.Top = e.Y + panel3.Top - y3; } }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What is panel3, if it's a control of any type, then it would have those properties.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      S 1 Reply Last reply
      0
      • C Christian Graus

        What is panel3, if it's a control of any type, then it would have those properties.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        S Offline
        S Offline
        shamsteady
        wrote on last edited by
        #3

        Actually it has that control but it need to be declared. But when i made it into class, but in class it can't be done.

        C 1 Reply Last reply
        0
        • S shamsteady

          Actually it has that control but it need to be declared. But when i made it into class, but in class it can't be done.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          OK, so the control does not exist ? You didn't say that. In the properties window of the designer, make sure the GenerateMember property is true. And, choose a better name for it.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          1 Reply Last reply
          0
          • S shamsteady

            There are error to compile this code because panel3.left and panel3.top are not defined in the class. How to overcome this? protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove (e); if (isDragging3 == true) { panel3.Left = e.X + panel3.Left - x3; panel3.Top = e.Y + panel3.Top - y3; } }

            M Offline
            M Offline
            M Hall
            wrote on last edited by
            #5

            The problem is that you have abstracted the class from the control, and you have control specific code: you should use protect override void OnmouseMouseMove(System.Object sender, System.Windows.Forms.MouseEventArgs e) then you should be able to access the left and top property's through the sender object

            S 1 Reply Last reply
            0
            • M M Hall

              The problem is that you have abstracted the class from the control, and you have control specific code: you should use protect override void OnmouseMouseMove(System.Object sender, System.Windows.Forms.MouseEventArgs e) then you should be able to access the left and top property's through the sender object

              S Offline
              S Offline
              shamsteady
              wrote on last edited by
              #6

              How to access the left and top property's through the sender object? Can you give example. i am new to c# and need guide..

              C 1 Reply Last reply
              0
              • S shamsteady

                How to access the left and top property's through the sender object? Can you give example. i am new to c# and need guide..

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                Sounds to me like you need to learn some C# before you try to write whatever it is you are trying to write. If you handle an event for a control, within your main class, then you have two incoming variables, like this protected void OnPaneResize(object sender, EventArgs ea) { } You can then do this: protected void OnPaneResize(object sender, EventArgs ea) { Control c = sender as Control; if (c != null) { c.Left = 5; // or whatever } }

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups