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. Graph Disappear Problem vol 2

Graph Disappear Problem vol 2

Scheduled Pinned Locked Moved C#
helpquestiongraphicsdata-structurestutorial
5 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
    StuffyEst
    wrote on last edited by
    #1

    I have returned with my "small" problem. Short overview: 1) Problem was/is that my graphics disappeared when you move them out of screen borders and pull them back or put some other window over them. 2) Graphics are updated every time I move my trackbar (which gives values to function to draw the graphic based on the values) So I've made some progress, but still stuck on other part. I have 3 different functions, one for graphic, second for graphic and third for axis. I solved the paint problem with Axis, since its static and never changes, so it was quite easy to convert to paint event. On the other hand, graphs have both 2 parameters that they receive and the graph changes after that according to the values given. Example : public void JoonistaGraafik(int k1, int k2) now when I want to make it to paint event "public void JoonistaGraafik(object sender,PaintEventArgs e, int k1, int k2)" I have problem calling out in InitializeComponents(); this.GraphPanel.Paint += new System.Windows.Forms.PaintEventHandler(JoonistaGraafik(slider_a, slider_b)); the thing is that, my two values "slider_a" and "slider_b" are generated in the trackbar_scroll event and then JoonistaGraafik(slider_a, slider_b); was called out. I'm pretty bad in explaining, but I hope that made a bit sence. In conclusion, the question is, how can I call out "this.GraphPanel.Paint += new System.Windows.Forms.PaintEventHandler(JoonistaGraafik(slider_a, slider_b));" if the slider_a and slider_b values have to change when I move the trackbar. Or how can I make a paint event which gets values from trackbars (means the graphic has to update itself every time trackbar is moved). Thanks for reading, and I hope someone can help me out (again).

    Y L 2 Replies Last reply
    0
    • S StuffyEst

      I have returned with my "small" problem. Short overview: 1) Problem was/is that my graphics disappeared when you move them out of screen borders and pull them back or put some other window over them. 2) Graphics are updated every time I move my trackbar (which gives values to function to draw the graphic based on the values) So I've made some progress, but still stuck on other part. I have 3 different functions, one for graphic, second for graphic and third for axis. I solved the paint problem with Axis, since its static and never changes, so it was quite easy to convert to paint event. On the other hand, graphs have both 2 parameters that they receive and the graph changes after that according to the values given. Example : public void JoonistaGraafik(int k1, int k2) now when I want to make it to paint event "public void JoonistaGraafik(object sender,PaintEventArgs e, int k1, int k2)" I have problem calling out in InitializeComponents(); this.GraphPanel.Paint += new System.Windows.Forms.PaintEventHandler(JoonistaGraafik(slider_a, slider_b)); the thing is that, my two values "slider_a" and "slider_b" are generated in the trackbar_scroll event and then JoonistaGraafik(slider_a, slider_b); was called out. I'm pretty bad in explaining, but I hope that made a bit sence. In conclusion, the question is, how can I call out "this.GraphPanel.Paint += new System.Windows.Forms.PaintEventHandler(JoonistaGraafik(slider_a, slider_b));" if the slider_a and slider_b values have to change when I move the trackbar. Or how can I make a paint event which gets values from trackbars (means the graphic has to update itself every time trackbar is moved). Thanks for reading, and I hope someone can help me out (again).

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      StuffyEst wrote:

      Subject: Graph Disappear Problem vol 2

      I didn't knew, now questions come in volumes.

      Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

      S 1 Reply Last reply
      0
      • Y Yusuf

        StuffyEst wrote:

        Subject: Graph Disappear Problem vol 2

        I didn't knew, now questions come in volumes.

        Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

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

        well I have old post but thats like on page 30.. and I have serious doubts people care to watch pages that far.

        1 Reply Last reply
        0
        • S StuffyEst

          I have returned with my "small" problem. Short overview: 1) Problem was/is that my graphics disappeared when you move them out of screen borders and pull them back or put some other window over them. 2) Graphics are updated every time I move my trackbar (which gives values to function to draw the graphic based on the values) So I've made some progress, but still stuck on other part. I have 3 different functions, one for graphic, second for graphic and third for axis. I solved the paint problem with Axis, since its static and never changes, so it was quite easy to convert to paint event. On the other hand, graphs have both 2 parameters that they receive and the graph changes after that according to the values given. Example : public void JoonistaGraafik(int k1, int k2) now when I want to make it to paint event "public void JoonistaGraafik(object sender,PaintEventArgs e, int k1, int k2)" I have problem calling out in InitializeComponents(); this.GraphPanel.Paint += new System.Windows.Forms.PaintEventHandler(JoonistaGraafik(slider_a, slider_b)); the thing is that, my two values "slider_a" and "slider_b" are generated in the trackbar_scroll event and then JoonistaGraafik(slider_a, slider_b); was called out. I'm pretty bad in explaining, but I hope that made a bit sence. In conclusion, the question is, how can I call out "this.GraphPanel.Paint += new System.Windows.Forms.PaintEventHandler(JoonistaGraafik(slider_a, slider_b));" if the slider_a and slider_b values have to change when I move the trackbar. Or how can I make a paint event which gets values from trackbars (means the graphic has to update itself every time trackbar is moved). Thanks for reading, and I hope someone can help me out (again).

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, I gave you all the necessary information 5 days ago[^], and I can tell you there is no way around doing it all in the Paint handler. You simply must, it is the only way to get it to paint whenever something needs repainted (as with uncovering part of your window when it has been covered by something else; as with resizing, minimizing and maximizing a window; as with printing which can reuse all the painting code; etc). In your specific situation, if you have two parameters that may change and cause your drawing to become invalid, what you do is: 1. store the drawing parameters that define your drawing as class members 2. draw everything (say on myPanel) in its Paint handler based on those parameters 3. and change those parameters where ever you feel you need to; and when you do change them, call myPanel.Invalidate() which will eventually result in myPanel.Paint() to be called automatically. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


          S 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, I gave you all the necessary information 5 days ago[^], and I can tell you there is no way around doing it all in the Paint handler. You simply must, it is the only way to get it to paint whenever something needs repainted (as with uncovering part of your window when it has been covered by something else; as with resizing, minimizing and maximizing a window; as with printing which can reuse all the painting code; etc). In your specific situation, if you have two parameters that may change and cause your drawing to become invalid, what you do is: 1. store the drawing parameters that define your drawing as class members 2. draw everything (say on myPanel) in its Paint handler based on those parameters 3. and change those parameters where ever you feel you need to; and when you do change them, call myPanel.Invalidate() which will eventually result in myPanel.Paint() to be called automatically. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


            S Offline
            S Offline
            StuffyEst
            wrote on last edited by
            #5

            Thanks a lot, finally got it all working as I wanted :)

            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