how can i create a rotating line using c#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nimalika
    New Member
    • Apr 2010
    • 3

    how can i create a rotating line using c#?

    I want to rotate the line according to the angle that i input.
  • kyndig
    New Member
    • Apr 2010
    • 3

    #2
    You can do this stuff with WPF

    Comment

    • GaryTexmo
      Recognized Expert Top Contributor
      • Jul 2009
      • 1501

      #3
      You can also use GDI+ or XNA. It really depends on your application.

      GDI+ is the WinForms graphics package.
      XNA is more of a Game/Graphical programming package.
      WPF could be though of as something like Flash for Windows Applications.

      What you need depends on what you've got now, and what you want to accomplish. Do you have any information about what you're wanting to do?

      Comment

      • Ensa
        New Member
        • Apr 2010
        • 1

        #4
        moving a line

        I'm trying to create an analog voltmeter using WindowsForms. First i display the voltage in a textbox. I need to rotate a line(as the needle) according to the value in the textbox.

        I need to do this using c#.

        Comment

        • nimalika
          New Member
          • Apr 2010
          • 3

          #5
          Originally posted by GaryTexmo
          You can also use GDI+ or XNA. It really depends on your application.

          GDI+ is the WinForms graphics package.
          XNA is more of a Game/Graphical programming package.
          WPF could be though of as something like Flash for Windows Applications.

          What you need depends on what you've got now, and what you want to accomplish. Do you have any information about what you're wanting to do?
          I'm trying to create an analog voltmeter interface. I want to rotate a line as the pointer.

          As the first step, digital voltage is displayed in a textbox. I need to rotate the pointer according to textbox value.

          Comment

          • nimalika
            New Member
            • Apr 2010
            • 3

            #6
            Originally posted by GaryTexmo
            You can also use GDI+ or XNA. It really depends on your application.

            GDI+ is the WinForms graphics package.
            XNA is more of a Game/Graphical programming package.
            WPF could be though of as something like Flash for Windows Applications.

            What you need depends on what you've got now, and what you want to accomplish. Do you have any information about what you're wanting to do?
            I'm trying to create an analog voltmeter interface. I want to rotate a line as the pointer.

            As the first step, digital voltage is displayed in a textbox. I need to rotate the pointer according to textbox value.

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              So either Ensa and Nimalika are the same person using two different accounts or they are two students working on the same homework assignment. Either way, I have merged their threads since they are asking the exact same question.

              Either way, GaryTexmo has pointed you at some good information.

              Drawing a line is very straightforward and explained in the MSDN


              You will have to use some 8th grade math skills to calculate the angle based on the size of your meter. If your meter is from 0 to 100 volts over 45 degrees of arc, the angle for 50volts will be different than if you meter is from 0 to 240 volts over 70 degrees of arc. So nobody here is going to be able to tell you how to do it.

              Bytes has a policy regarding assisting students with their homework.

              The short version is that the volunteers here can't help you with schoolwork.
              A) We don't know what material you have and have not learned in class.
              B) We don't know the guidelines you must follow.
              C) In the long run giving you the answers actually short changes your education.

              Hint 1: Try hitting Google with terms of your programming language and primary terms of what you want to do. For example "C# custom events" or "VB datagrid Excel". I've found this to be a very effective tool.
              Hint 2: Your text book
              Hint 3: Your instructor
              Hint 4: Posting guidelines regarding homework assignments.

              Comment

              • GaryTexmo
                Recognized Expert Top Contributor
                • Jul 2009
                • 1501

                #8
                Haha busted!

                Well, you might as well learn something new while you're at it. This smells like a great opportunity for a user control. Try a google search on "C# User Control" to find some great resources.

                The end result here is you'll be able to make something you can drop down on the designer (like a button or a text box), set some designer properties, and away you go.

                Just because it's an assignment doesn't mean you can't do something cool with it :)

                Comment

                Working...