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. A Paint like application

A Paint like application

Scheduled Pinned Locked Moved C#
helptutorialannouncement
8 Posts 4 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.
  • J Offline
    J Offline
    jaypatel512
    wrote on last edited by
    #1

    Hello friends.. I came accross a small problem. I need to draw something e.g. rectangles, circles, ellipses ,etc. I read the articles and learnt how to draw them , but as we can see the rectangle with a broken border as in paint until and unless we release the mouse , I am unable to do such in my application... Please help...

    R 1 Reply Last reply
    0
    • J jaypatel512

      Hello friends.. I came accross a small problem. I need to draw something e.g. rectangles, circles, ellipses ,etc. I read the articles and learnt how to draw them , but as we can see the rectangle with a broken border as in paint until and unless we release the mouse , I am unable to do such in my application... Please help...

      R Offline
      R Offline
      Rob Philpott
      wrote on last edited by
      #2

      Dude, I think you need to rephrase that. I really can't understand what you want to say.

      Regards, Rob Philpott.

      J 1 Reply Last reply
      0
      • R Rob Philpott

        Dude, I think you need to rephrase that. I really can't understand what you want to say.

        Regards, Rob Philpott.

        J Offline
        J Offline
        jaypatel512
        wrote on last edited by
        #3

        if we need to draw a rectangle in a picture box we can do so easily.. on mouse down event i save the mouse cordinates. And on mouse up event i can draw a rectangle using the pointer position... All works fine. . But actually if you do such in paint, you can see a rectangle being drawn as we move our mouse ... How to doso ??

        D R H 3 Replies Last reply
        0
        • J jaypatel512

          if we need to draw a rectangle in a picture box we can do so easily.. on mouse down event i save the mouse cordinates. And on mouse up event i can draw a rectangle using the pointer position... All works fine. . But actually if you do such in paint, you can see a rectangle being drawn as we move our mouse ... How to doso ??

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          You need to draw the rectangles in MouseMove event as well along with Paint. (If I understood you correctly.)

          जय हिंद

          J 1 Reply Last reply
          0
          • J jaypatel512

            if we need to draw a rectangle in a picture box we can do so easily.. on mouse down event i save the mouse cordinates. And on mouse up event i can draw a rectangle using the pointer position... All works fine. . But actually if you do such in paint, you can see a rectangle being drawn as we move our mouse ... How to doso ??

            R Offline
            R Offline
            Rob Philpott
            wrote on last edited by
            #5

            Ah ok, On the mouse down event, set a boolean to true. In the mouse up event, set it to false. In the Mouse move event, check the boolean and if its true then draw the rectangle. That should do what you want.

            Regards, Rob Philpott.

            1 Reply Last reply
            0
            • J jaypatel512

              if we need to draw a rectangle in a picture box we can do so easily.. on mouse down event i save the mouse cordinates. And on mouse up event i can draw a rectangle using the pointer position... All works fine. . But actually if you do such in paint, you can see a rectangle being drawn as we move our mouse ... How to doso ??

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #6

              The answers already given will work. For some added 'cool' features Google for 'rubberbanding c#', and search MSDN for DrawReversibleFrame the page that you get has a nice example. Good Luck! :)

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              J 1 Reply Last reply
              0
              • D dan sh

                You need to draw the rectangles in MouseMove event as well along with Paint. (If I understood you correctly.)

                जय हिंद

                J Offline
                J Offline
                jaypatel512
                wrote on last edited by
                #7

                You got it correct. .. I have already done that, but what happens is once a rectangle is drawn with mouse move event , I am unable to remove it.. Thats the main problem ..

                1 Reply Last reply
                0
                • H Henry Minute

                  The answers already given will work. For some added 'cool' features Google for 'rubberbanding c#', and search MSDN for DrawReversibleFrame the page that you get has a nice example. Good Luck! :)

                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                  J Offline
                  J Offline
                  jaypatel512
                  wrote on last edited by
                  #8

                  This was it that i want. . . Rubberbanding. . I was unaware of that word.. Thanx anyway dude .

                  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