Home > Software engineering > Everyone a great god for guidance! Using MFC to do a interface, a machine under every two seconds vi
Everyone a great god for guidance! Using MFC to do a interface, a machine under every two seconds vi
Time:09-24
Everyone a great god for guidance! Using MFC to do a interface, a machine under every two seconds via a serial port pass data to the PC, now receives data from the serial port, to rectangular, according to the data real-time onpaint function called how ah, or how to use these data to draw ah, now I am in the heart of the class in the serial data to the onpaint, then set a timer, every two seconds to invalidate and updatewindow, but can't window display graphics, please everyone a great god some directions, I is based on the MFC dialog application
CodePudding user response:
Assuming that the received data is a rectangular coordinate points, two kind of situations: 1, updated in real time, the UI is only above a rectangular display don't erase the last time, that this kind of situation, only need to set a member/global variables, a serial port receives the data changes of the variables, and then call the CDC painting, rather than using the timer!!!!! 2, live more analysis, UI shown above multiple rectangular, don't erase the last time, then use the vector or a queue to store, a serial port receives the rectangular coordinates push_back, every time the timer callback CDC draw this list or queue
CodePudding user response:
Play against the above, 1 kind is showing only one, the second is multiple