CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    OnPaint() PROBLEM???

    HI,

    Iam developing a VC+= application(client) which does plotting the values on the screeen getting values from the server VC++ app.The code for plotting values is written in OnPaint() function in client app. The communication between applications is through sockets.

    I have a problem , when ever I switch between applications the OnPain() function in client app is getting called and it tries to replot from the beginning. Since the plot is to be done getting values at the real time the graph is getting distorted.Please let me know the solution for this.

    Thanx


  2. #2
    Join Date
    May 1999
    Location
    Mass, USA.
    Posts
    103

    Re: OnPaint() PROBLEM???

    Your OnPaint() handler should be very "dumb". That is, it shouldn't
    perform any computations or other logic - it should just paint (render)
    stuff on the screen.

    The "stuff" you render should be stored in an array or list which continously
    gets updated in a separate thread by communicating with your server
    app. If you're not familiar with threads, you could just create a timer and
    add the code to update the "stuff" in OnTimer().


    OnTimer()
    {
    populate my_array[] with data;
    Invalidate();
    }

    OnPaint()
    {
    traverse my_array[] and draw on the screen
    }




    /ravi



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured