public void drawCircle(cutStrandInfo strand) { Graphics graphics = this.CreateGraphics(); Pen pen = new Pen(Color.Gray, 10); Pen redpen = new Pen(Color.Red, 4); Pen cutpen = new Pen(Color.Red, 20); Pen fengpen = new Pen(Color.Green, 10); int gundaofeng = 3; //弧形+辊道 graphics.DrawArc(pen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, 90, 90); graphics.DrawLine(pen, strand.circlePointX + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + strand.gunaochangdu + gundaofeng, strand.circlePointY + strand.radius); //火切机位置 int hqj = Convert.ToInt32((strand.huoqiejiweizhi - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(cutpen, strand.circlePointX + hqj + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + hqj + 3 + gundaofeng, strand.circlePointY + strand.radius); if (strand.zhupiStart > strand.shanxingweizhi) { int hudu = Convert.ToInt32((strand.shanxingweizhi - strand.zhupiEnd) * 90.0 / strand.shanxingweizhi); graphics.DrawArc(redpen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, 90, hudu); int changdu = Convert.ToInt32((strand.zhupiStart - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(redpen, strand.circlePointX + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + changdu + gundaofeng, strand.circlePointY + strand.radius); } foreach (var item in strand.listfeng) { //end点的跟踪值-缝跟踪值- +end点的位置 double fengweizhi = strand.endtrack - item.endTrack + strand.zhupiEnd; if (fengweizhi < strand.shanxingweizhi) { int starthudu = Convert.ToInt32(180 - fengweizhi * 90.0 / strand.shanxingweizhi); graphics.DrawArc(fengpen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, starthudu, 3); } else { int changdu = Convert.ToInt32((fengweizhi - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(fengpen, strand.circlePointX + changdu + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + changdu + 3 + gundaofeng, strand.circlePointY + strand.radius); } } }
public void drawCircle(cutStrandInfo strand) { Graphics graphics = this.CreateGraphics(); Pen pen = new Pen(Color.Gray, 10); Pen redpen = new Pen(Color.Red, 4); Pen cutpen = new Pen(Color.Red, 20); Pen fengpen = new Pen(Color.Green, 10); int gundaofeng = 3; #region 1、弧形+辊道 2、火切机位置 静态的 //弧形+辊道 graphics.DrawArc(pen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, 90, 90); graphics.DrawLine(pen, strand.circlePointX + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + strand.gunaochangdu + gundaofeng, strand.circlePointY + strand.radius); //火切机位置 int hqj = Convert.ToInt32((strand.huoqiejiweizhi - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(cutpen, strand.circlePointX + hqj + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + hqj + 3 + gundaofeng, strand.circlePointY + strand.radius); #endregion #region 红坯位置 //坯头位置不超过辊道+扇形长度 if (strand.zhupiStart > strand.shijigunaochangdu + strand.shanxingweizhi) { strand.zhupiStart = strand.shijigunaochangdu + strand.shanxingweizhi; } //铸坯头超过扇形段 if (strand.zhupiStart > strand.shanxingweizhi) { //铸坯尾没有超过扇形段,绘制弧度和直线 if (strand.zhupiEnd < strand.shanxingweizhi) { int hudu = Convert.ToInt32((strand.shanxingweizhi - strand.zhupiEnd) * 90.0 / strand.shanxingweizhi); graphics.DrawArc(redpen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, 90, hudu); int changdu = Convert.ToInt32((strand.zhupiStart - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(redpen, strand.circlePointX + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + changdu + gundaofeng, strand.circlePointY + strand.radius); } //铸坯尾超过扇形段 绘制直线 else { int qidian = Convert.ToInt32((strand.zhupiEnd - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); int changdu = Convert.ToInt32((strand.zhupiStart - strand.zhupiEnd) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(redpen, strand.circlePointX + gundaofeng + qidian, strand.circlePointY + strand.radius, strand.circlePointX + changdu + gundaofeng + qidian, strand.circlePointY + strand.radius); } } else { if (strand.zhupiStart > strand.zhupiEnd) { int hudu = Convert.ToInt32((strand.zhupiStart - strand.zhupiEnd) * 90.0 / strand.shanxingweizhi); int qidian = Convert.ToInt32((strand.shanxingweizhi - strand.zhupiStart) * 90.0 / strand.shanxingweizhi); graphics.DrawArc(redpen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, 90 + qidian, hudu); } } #endregion foreach (var item in strand.listfeng) { //end点的跟踪值-缝跟踪值- +end点的位置 double fengweizhi = strand.endtrack - item.endTrack + strand.zhupiEnd; if (fengweizhi < strand.shanxingweizhi) { int starthudu = Convert.ToInt32(180 - fengweizhi * 90.0 / strand.shanxingweizhi); if (starthudu > 177) { starthudu = 177; } graphics.DrawArc(fengpen, strand.circlePointX - strand.radius, strand.circlePointY - strand.radius, 2 * strand.radius, 2 * strand.radius, starthudu, 3); if (strand.strandid == 1) { lbladlefeng.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX - strand.radius * Math.Sin((starthudu - 90) * Math.PI / 180)); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius * Math.Cos((starthudu - 90) * Math.PI / 180)) - 20; lbladlefeng.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng.Text = "大包缝炉号:" + item.heatid; } else if (strand.strandid == 2 && lbladlefeng.Visible == false) { lbladlefeng2.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX - strand.radius * Math.Sin((starthudu - 90) * Math.PI / 180)); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius * Math.Cos((starthudu - 90) * Math.PI / 180)) - 20; lbladlefeng2.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng2.Text = "大包缝炉号:" + item.heatid; } else if (strand.strandid == 3 && lbladlefeng.Visible == false && lbladlefeng2.Visible == false) { lbladlefeng3.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX - strand.radius * Math.Sin((starthudu - 90) * Math.PI / 180)); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius * Math.Cos((starthudu - 90) * Math.PI / 180)) - 20; lbladlefeng3.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng3.Text = "大包缝炉号:" + item.heatid; } else if (strand.strandid == 3 && lbladlefeng.Visible == false && lbladlefeng2.Visible == false && lbladlefeng3.Visible == false) { lbladlefeng4.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX - strand.radius * Math.Sin((starthudu - 90) * Math.PI / 180)); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius * Math.Cos((starthudu - 90) * Math.PI / 180)) - 20; lbladlefeng4.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng4.Text = "大包缝炉号:" + item.heatid; } } else { int changdu = Convert.ToInt32((fengweizhi - strand.shanxingweizhi) * strand.gunaochangdu / strand.shijigunaochangdu); graphics.DrawLine(fengpen, strand.circlePointX + changdu + gundaofeng, strand.circlePointY + strand.radius, strand.circlePointX + changdu + 3 + gundaofeng, strand.circlePointY + strand.radius); if (strand.strandid == 1) { lbladlefeng.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX + changdu + gundaofeng); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius - 20); lbladlefeng.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng.Text = "大包缝炉号:" + item.heatid; } else if (strand.strandid == 2 && lbladlefeng.Visible == false) { lbladlefeng2.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX + changdu + gundaofeng); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius - 20); lbladlefeng2.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng2.Text = "大包缝炉号:" + item.heatid; } else if (strand.strandid == 3 && lbladlefeng.Visible == false && lbladlefeng2.Visible == false) { lbladlefeng3.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX + changdu + gundaofeng); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius - 20); lbladlefeng3.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng3.Text = "大包缝炉号:" + item.heatid; } else if (strand.strandid == 3 && lbladlefeng.Visible == false && lbladlefeng2.Visible == false && lbladlefeng3.Visible == false) { lbladlefeng4.Visible = true; int lableX = Convert.ToInt32(strand.circlePointX + changdu + gundaofeng); int lableY = Convert.ToInt32(strand.circlePointY + strand.radius - 20); lbladlefeng4.Location = new System.Drawing.Point(lableX, lableY); lbladlefeng4.Text = "大包缝炉号:" + item.heatid; } } } }