System.Drawing.Pen myPen; myPen = new System.Drawing.Pen(System.Drawing.Color.Black);
您应该始终对使用系统资源的任何对象(如 Pen 对象)调用 Dispose。