winform手绘Step步骤进度节点线条图
? ?
void drawStep(Panel panel1)
? ? ? ? {
? ? ? ? ? ? int[] rowHeights = new int[] { 100, 200, 80, 40 };
? ? ? ? ? ? ///直徑
? ? ? ? ? ? int rectLenth = 20;
? ? ? ? ? ? Graphics graphics = panel1.CreateGraphics();
? ? ? ? ? ? graphics.SmoothingMode = SmoothingMode.AntiAlias; ?//使繪圖質量最高,即消除鋸齒
? ? ? ? ? ? graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
? ? ? ? ? ? graphics.CompositingQuality = CompositingQuality.HighQuality;
? ? ? ? ? ? int lenTotal = 0;
? ? ? ? ? ? //繪制中線
? ? ? ? ? ? graphics.Clear(Color.LightYellow);
? ? ? ? ? ? Color c = new Color();
? ? ? ? ? ? c = Color.Black;
? ? ? ? ? ? for (int i = 0; i < rowHeights.Length; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? int rowHeight = rowHeights[i];
? ? ? ? ? ? ? ? lenTotal += rowHeight;
? ? ? ? ? ? ? ? int x1 = panel1.Width / 2;
? ? ? ? ? ? ? ? int y1 = 0;
? ? ? ? ? ? ? ? int x2 = x1;
? ? ? ? ? ? ? ? int y2 = rowHeight;
? ? ? ? ? ? ? ? int rectX = x1 - rectLenth / 2;
? ? ? ? ? ? ? ? int rectsemi = rectLenth / 2;
? ? ? ? ? ? ? ? int rectY = rowHeight / 2 - rectLenth / 2;
? ? ? ? ? ? ? ? if (i == 0)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? c = Color.Red;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? y1 = lenTotal - rowHeight;
? ? ? ? ? ? ? ? ? ? y2 = lenTotal;
? ? ? ? ? ? ? ? ? ? c = Color.Black;
? ? ? ? ? ? ? ? ? ? rectY = y1 + rowHeights[i] / 2 - rectsemi;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? graphics.DrawLine(new Pen(c, 5), x1, y1, x2, y2);
? ? ? ? ? ? ? ? graphics.FillEllipse(new SolidBrush(c),
? ? ? ? ? ? ? ? ? ? ? ? ? new Rectangle(new Point(rectX, rectY),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? new Size(rectLenth, rectLenth)));
? ? ? ? ? ? }
? ? ? ? }
?
剛發現個現象,用Alt鍵時繪的圖居然消息了,要放在paint事件中,就不會了
總結
以上是生活随笔為你收集整理的winform手绘Step步骤进度节点线条图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python两个excel字段模糊匹配_
- 下一篇: 万兆以太网的接口规范及万兆网络变压器相关