使用GID+原生代码编写实时动态曲线组件
private void DrawAsync(PaintEventArgs e)
{
if ((points != null && points.Count() > 0) || (points1 != null && points1.Count() > 0))
{
PointF[] pointsNew = points.ToList().Where(c => c.Y != StartHight).ToArray();
PointF[] pointsNew1 = points1.ToList().Where(c => c.Y != StartHight).ToArray();
if ((pointsNew.Length > 1) || (pointsNew1.Length > 1))
{
Graphics g = e.Graphics;
// 在内存中创建图像
Bitmap bufferImage = new Bitmap(this.Width, this.Height);
// 使用Invoke将绘制操作回到UI线程
using (Graphics gxOff = Graphics.FromImage(bufferImage))
{
// 绘制多条曲线
// 在这里添加绘图代码
if (pointsNew.Length > 1)
{
gxOff.DrawCurve(myPen, pointsNew);
}
if (pointsNew