. NET oscilloscope Control Example Code Analysis _ Practical Skills

Source: Internet
Author: User

Origin
A coworker-owned project scans for the presence of something in the hardware, so the boss would like to have an image-painted interface to view the results of these scans.
So a gadget is available to read the data that the colleague has provided and visualize it
That shows the results of the scan is the easiest oscilloscope, but the Third-party control of the oscilloscope function is too cumbersome, and finally decided to make a simple
Anyway, it's not too much time for me to draw with GDI and spend time researching unused third-party controls.

Ideas



As shown in the picture, the oscilloscope is actually such a simple diagram
The whole idea is actually very simple, an oscilloscope is divided into three parts to draw.
First is the horizontal line above, which usually denotes high values.
The second block is the horizontal line below, which means that the low straight
The third part is the link perpendicular to the line
The height of the operation, I was in the simplest way, the height of a UC directly apart from 2, as the center y coordinates
The high point is the position of the center y coordinates, height/5.
The lower point is the center y coordinates down, the height/5 position
Part of the oscilloscope is to remove the end of the line and then divide the data into two parts.
One part is the height of the coordinates to be drawn, and the other part is the coordinates to be drawn for the low point
With these two coordinates, we can draw the vertical line at the same time.
The ratio is the use of the value of the oscilloscope, and the width of the control to make a proportional adjustment
Code

Copy Code code as follows:

int max = m_mappingdatas[m_mappingdatas.count-1];
M_ratio = (max + m_mappingdatas[0]*2)/m_width;
Draw Wafer Data
for (int i = 1, j = 0; I < M_mappingdatas.count i+=2, J + +)
{
float xstart = m_mappingdatas[i-1];
float xend = m_mappingdatas[i];
Graphics. DrawLine (pen, Xstart/m_ratio, M_ypositionofwafer,
Xend/m_ratio, M_ypositionofwafer);
Graphics. DrawString ((j+1). ToString (), Control.defaultfont, Brush,
(Xstart/m_ratio)-2, M_ypositionofnowafer + 1);
}
Draw No Wafer Data
Graphics. DrawLine (pen, 0, M_ypositionofnowafer,
M_mappingdatas[0]/m_ratio, m_ypositionofnowafer);
for (int i = 2; I < M_mappingdatas.count i + + 2)
{
float xstart = m_mappingdatas[i-1];
float xend = m_mappingdatas[i];
Graphics. DrawLine (pen, Xstart/m_ratio, M_ypositionofnowafer,
Xend/m_ratio, M_ypositionofnowafer);
}
Graphics. DrawLine (pen, m_mappingdatas[m_mappingdatas.count-1]/m_ratio, M_ypositionofnowafer,
M_width, M_ypositionofnowafer);
Draw Vertical Line
for (int i = 1; i < M_mappingdatas.count i + + 2)
{
float X1 = m_mappingdatas[i-1];
float X2 = m_mappingdatas[i];
Graphics. DrawLine (pen, X1/m_ratio, M_ypositionofwafer,
X1/m_ratio, M_ypositionofnowafer);
Graphics. DrawLine (pen, X2/m_ratio, M_ypositionofwafer,
X2/m_ratio, M_ypositionofnowafer);
}

In my code, I want to scan a semiconductor wafer, so the high point is that there is a wafer, and a low is to indicate that there is no crystal circle.
Project Downloads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.