半导体晶圆厂里,设备要 HMI,MES 要客户端,工程师要看良率分布。 这些场景的共同点是:实时数据 + 可视化界面 + Windows 生态。
C# + WPF 正好合适:
所谓“晶圆生成”,在软件层通常指: 根据 Die 坐标和良率数据,生成一张可交互的晶圆图。
一张晶圆图,拆开只有三样东西:
WPF 里用 Canvas 最直接。
每个 Die 画一个 Rectangle,圆形外的跳过。
XAML 只留一个画布:
<Window x:Class="WaferApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Wafer Map" Width="440" Height="460">
<Canvas x:Name="Wafer" Width="400" Height="400"/>
</Window>后台代码约 20 行:
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DrawWafer(20);
}
void DrawWafer(int n)
{
double r = 180, cx = 200, cy = 200, d = 18;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{
double x = (i - n / 2.0) * d + cx;
double y = (j - n / 2.0) * d + cy;
if ((x - cx) * (x - cx) + (y - cy) * (y - cy) > r * r) continue;
bool good = (i + j) % 7 != 0; // 模拟良品
var rect = new Rectangle
{
Width = d - 1,
Height = d - 1,
Fill = good ? Brushes.Green : Brushes.Red
};
Canvas.SetLeft(rect, x);
Canvas.SetTop(rect, y);
Wafer.Children.Add(rect);
}
}
}运行后,你会看到一张圆形晶圆图: 绿色是良品 Die,红色是不良品 Die。
上面只是演示。真正上产线,还要加:
DrawingVisual 或 WriteableBitmapC# + WPF 做半导体晶圆图,代码可以很少。 核心就是:坐标 + 状态 + 绘制。
少量代码能跑通 Demo, 但真正决定生产可用性的,是数据接入、MVVM 分层和性能优化。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。