Sample Code for. NET oscilloscope controls

Source: Internet
Author: User

Origin
A project under the responsibility of a colleague scans whether something in the hardware exists. Therefore, the boss wants to view the scan results through an image-based interface.

Therefore, we made a small tool to read and visualize the data provided by our colleagues.

The easiest way to display the scan results is the oscilloscope, but the functions of the third-party controls are too cumbersome. In the end, I decided to make a simple one myself.

Anyway, for me to use GDI to draw, it will not be too time-consuming to study unused third-party controls.


Ideas


The first is the above horizontal line, which usually indicates a high value.

The second is the horizontal line below, indicating the low straight

The third part is to link the vertical line
In height calculation, I use the simplest method to divide the height of a UC directly by 2 and use it as the center y coordinate.

Indicates that the high point is the center y coordinate up, the height/5 position

The low point is the center y coordinate down, the height/5 position

In the oscilloscope, remove the line at the beginning and end, and then split the data into two parts.

One part is the coordinates to be drawn at the high point, and the other part is the coordinates to be drawn at the low point.

With these two coordinates, you can draw vertical lines at the same time.

Proportional adjustment is based on the oscilloscope value and the width of the control.
Code
[Csharp]
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 indicates that there is a wafer, and the low point indicates that there is no wafer.

Project download: http://www.bkjia.com/uploadfile/2012/0405/20120405021510283.rar
 


From Cloud Hsu's column

Related Article

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.