畫板

 //新建畫板
            System.Drawing.Graphics G = System.Drawing.Graphics.FromImage(methods.bitmap);
            G.Clear(Color.White);

            int cs2 = cs * 2;

            //設置顏色,寬度
            Pen pen = new Pen(Color.Black, 2);

            G.DrawLine(new Pen(Color.LightSteelBlue, 1), 300, 250 - id / 2 - cs - 40, 300, 250 + id / 2 + cs);
            G.DrawLine(new Pen(Color.LightSteelBlue, 1), 300 - id / 2 - cs - 20, 230, 300 + id / 2 + cs + 20, 230);

            //大圓
            G.DrawEllipse(pen, ((300 - id / 2) - cs), ((230 - id / 2) - cs), (id + cs2), (id + cs2));
            //小圓
            G.DrawEllipse(pen, (300 - id / 2), (230 - id / 2), id, id);

            G.DrawLine(new Pen(Color.LightSteelBlue, 1), 300, 250 + id / 2 + 30 + cs, 300, 250 + id / 2 + 70 + cs * 2);

            G.DrawLine(new Pen(Color.LightSteelBlue, 1), 300 - id / 2, 250 + id / 2 + 5 + cs, 300 - id / 2, 250 + id / 2 + 35 + cs * 2);
            G.DrawLine(new Pen(Color.LightSteelBlue, 1), 300 + id / 2, 250 + id / 2 + 5 + cs, 300 + id / 2, 250 + id / 2 + 35 + cs * 2);

            //小圓
            Rectangle r1 = new Rectangle(300 - id / 2 - cs, (300 + id / 2 + cs), cs, cs);
            Rectangle r2 = new Rectangle(300 + id / 2, (300 + id / 2 + cs), cs, cs);

            //直線
            G.DrawLine(new Pen(Color.SkyBlue, 1), 300 - id / 2 - cs / 2, (300 + id / 2 + cs), 300 + id / 2 + cs / 2, (300 + id / 2 + cs));
            //直線
            G.DrawLine(new Pen(Color.SkyBlue, 1), 300 - id / 2 - cs / 2, (300 + id / 2 + cs) + cs, 300 + id / 2 + cs / 2, (300 + id / 2 + cs) + cs);

            HatchBrush hb = new HatchBrush(HatchStyle.DarkUpwardDiagonal, Color.LightSteelBlue, Color.White);
            G.DrawEllipse(pen, r2);
            G.FillEllipse(hb, r2);

            G.DrawEllipse(pen, r1);
            G.FillEllipse(hb, r1);

            int x = 300 - id / 2;
            int y = 250 + id / 2 + 20 + cs;

            int x1 = 300 + id / 2;
            //
            Point[] ps = new Point[8];
            ps[0] = new Point(x + 5, y + 5);
            ps[1] = new Point(x, y);
            ps[2] = new Point(x + 5, y - 5);
            ps[3] = new Point(x, y);
            ps[4] = new Point(x1, y);
            ps[5] = new Point(x1 - 5, y - 5);
            ps[6] = new Point(x1, y);
            ps[7] = new Point(x1 - 5, y + 5);

            G.DrawLines(new Pen(Color.SkyBlue, 1), ps);

            //設置字體
            System.Drawing.Font f = new System.Drawing.Font("宋体", 10);
            //設置顏色
            System.Drawing.Brush b = new SolidBrush(Color.Black);

            if (!Methods.units.Equals("mm"))
            {
                ids = Methods.GetINCH(ids);
                css = Methods.GetINCH(css);
            }
            G.DrawString("Ø" + ids + "±" + this.txtIdT.Text.Trim(), f, b, 270, (300 + id / 2 + 20) + cs / 2 - 30);
            G.DrawString("Ø" + css + "±" + this.txtCST.Text.Trim(), f, b, 300 + id / 2 + cs, (300 + id / 2 + 20 + cs));

           

            G.Dispose();
            //保存高清晰度的缩略图
            methods.bitmap.Save(Methods.paths, System.Drawing.Imaging.ImageFormat.Jpeg);
            methods.bitmap.Dispose();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值