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. uerasable lines

uerasable lines

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
10 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
    ssoffline
    wrote on last edited by
    #1

    Hi I am developing an application for making data flow diagrams in c#, i can move around objects and also draw lines from one point to another, but the problem is that once the lines are drawn and then i move other objects around the lines get erased for obvious reasons how to get rid of that?

    Sameer Sood Microsoft Student partner NIT Durgapur,India :-O

    G 1 Reply Last reply
    0
    • S ssoffline

      Hi I am developing an application for making data flow diagrams in c#, i can move around objects and also draw lines from one point to another, but the problem is that once the lines are drawn and then i move other objects around the lines get erased for obvious reasons how to get rid of that?

      Sameer Sood Microsoft Student partner NIT Durgapur,India :-O

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      That is because you are drawing on the screen where the control happens to be instead of using the control to do the drawing. Use the Paint event of the control to do the drawing. Then whenever the control has to be redrawn for any reason, the lines will also be redrawn. Store the coordinates of the lines to draw in a list or something. Add coordinates to the list and use the Invalidate method on the control to make it redraw itself.

      --- b { font-weight: normal; }

      S 1 Reply Last reply
      0
      • G Guffa

        That is because you are drawing on the screen where the control happens to be instead of using the control to do the drawing. Use the Paint event of the control to do the drawing. Then whenever the control has to be redrawn for any reason, the lines will also be redrawn. Store the coordinates of the lines to draw in a list or something. Add coordinates to the list and use the Invalidate method on the control to make it redraw itself.

        --- b { font-weight: normal; }

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

        i knw that and i hv done it the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?

        Sameer Sood Microsoft Student partner NIT Durgapur,india

        J G 2 Replies Last reply
        0
        • S ssoffline

          i knw that and i hv done it the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?

          Sameer Sood Microsoft Student partner NIT Durgapur,india

          J Offline
          J Offline
          J4amieC
          wrote on last edited by
          #4

          plz dnt us txtspk in 4rm, it mks psts v.hrd 2 rd

          --- How to get answers to your questions[^]

          1 Reply Last reply
          0
          • S ssoffline

            i knw that and i hv done it the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?

            Sameer Sood Microsoft Student partner NIT Durgapur,india

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            If "u" "hv" done it that way, what is the problem? Whenever a part of the form needs repainting, it will first draw it's background, then "ur" event handler for the Paint event will draw the lines on top of it. It doesn't matter how "u" draw the lines, as they will always "b" drawn from the same state. If "u" "re" drawing a line like mspaint, "u" "wd" "b" drawing it on a bitmap, then displaying the bitmap.

            --- b { font-weight: normal; }

            S 1 Reply Last reply
            0
            • G Guffa

              If "u" "hv" done it that way, what is the problem? Whenever a part of the form needs repainting, it will first draw it's background, then "ur" event handler for the Paint event will draw the lines on top of it. It doesn't matter how "u" draw the lines, as they will always "b" drawn from the same state. If "u" "re" drawing a line like mspaint, "u" "wd" "b" drawing it on a bitmap, then displaying the bitmap.

              --- b { font-weight: normal; }

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

              hi First do it then answer me, imagine a scenario where 5 or ten lines are there, and also 5 or 6 controls object on the same board which you can move with mouse,so first question how will you know which line to refresh or redraw, the even if u redraw then the flickers are so high that it doesn't look nice, plus then as i said it's reversible lines , so when some part of it is missed and then i redraw, that missed part gets erased permanently, it's easier said than done my friend , pls try it.

              Sameer Sood Microsoft Student partner NIT Durgapur,india

              G 1 Reply Last reply
              0
              • S ssoffline

                hi First do it then answer me, imagine a scenario where 5 or ten lines are there, and also 5 or 6 controls object on the same board which you can move with mouse,so first question how will you know which line to refresh or redraw, the even if u redraw then the flickers are so high that it doesn't look nice, plus then as i said it's reversible lines , so when some part of it is missed and then i redraw, that missed part gets erased permanently, it's easier said than done my friend , pls try it.

                Sameer Sood Microsoft Student partner NIT Durgapur,india

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Yes, as you are using reversible lines you have to redraw everything around a line when you are moving it, so you will have some flickering. You can specify a rectangle for the Invalidate method to make it redraw only the needed part of the control.

                --- b { font-weight: normal; }

                S 1 Reply Last reply
                0
                • G Guffa

                  Yes, as you are using reversible lines you have to redraw everything around a line when you are moving it, so you will have some flickering. You can specify a rectangle for the Invalidate method to make it redraw only the needed part of the control.

                  --- b { font-weight: normal; }

                  S Offline
                  S Offline
                  ssoffline
                  wrote on last edited by
                  #8

                  ya i know about that , how will i detect that which line to redaw among so many lines, this is the main problem how to get the rectangle at the right place

                  Sameer Sood Microsoft Student partner NIT Durgapur,india

                  G 1 Reply Last reply
                  0
                  • S ssoffline

                    ya i know about that , how will i detect that which line to redaw among so many lines, this is the main problem how to get the rectangle at the right place

                    Sameer Sood Microsoft Student partner NIT Durgapur,india

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    ssoffline wrote:

                    how will i detect that which line to redaw among so many lines

                    Eh? Are you unable detect what line you just changed yourself?

                    --- b { font-weight: normal; }

                    S 1 Reply Last reply
                    0
                    • G Guffa

                      ssoffline wrote:

                      how will i detect that which line to redaw among so many lines

                      Eh? Are you unable detect what line you just changed yourself?

                      --- b { font-weight: normal; }

                      S Offline
                      S Offline
                      ssoffline
                      wrote on last edited by
                      #10

                      Not that, i mean lines are there, but as i move other objects (not lines), then they may move over any of the line may be one or more, how to detect that, u need to redraw then.

                      Sameer Sood Microsoft Student partner NIT Durgapur,india

                      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