/// ------------------------------------------------------------------------------------ /// <summary> /// </summary> /// ------------------------------------------------------------------------------------ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Draw the etched, horizontal line separating the wizard buttons // from the rest of the form. LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, btn_help.Bounds); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Paint an etched line to separate main controls from Add, Cancel, and Help buttons. /// </summary> /// <param name="e">Paint Event arguments</param> /// ------------------------------------------------------------------------------------ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Draw the etched, horizontal line separating the Add/Cancel/Help buttons LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, btnAdd.Top - (this.ClientRectangle.Bottom - btnAdd.Bottom)); }
/// ----------------------------------------------------------------------------------- /// <summary> /// This will make sure an etched line is drawn above the OK and Help buttons. /// </summary> /// ----------------------------------------------------------------------------------- protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Draw the etched, horizontal line separating the OK and Help buttons // from the rest of the form. LineDrawing.Draw(e.Graphics, 10, btnOK.Top - 10, this.ClientSize.Width - 20, LineTypes.Etched); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Paint an etched line to separate main controls from OK, Cancel, and Help buttons. /// </summary> /// <param name="e">Paint Event arguments</param> /// ------------------------------------------------------------------------------------ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Draw the etched, horizontal line separating the buttons from the stuff above // them. LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, btnBackup.Bounds); }
/// ------------------------------------------------------------------------------------ /// <summary> /// This will draw the the etched line that separates the dialog's buttons at the /// bottom from the rest of the dialog. /// </summary> /// ------------------------------------------------------------------------------------ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Draw the line between the marker name and the exclude check box. LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, (mappingDetailsCtrl.Top + markerLabel.Bottom) / 2); // Draw the line separating the buttons from the rest of the form. LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, btnHelp.Bounds); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
/// ----------------------------------------------------------------------------------- /// <summary> /// This will draw the the etched line that separates the dialog's buttons at the /// bottom from the rest of the dialog. It will also call the method to update the /// "Step x of n" label. /// </summary> /// ----------------------------------------------------------------------------------- protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Draw the etched, horizontal line separating the wizard buttons // from the rest of the form. LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, lblSteps.Bottom + (m_btnHelp.Top - lblSteps.Bottom) / 2); UpdateStepLabel(); }
private void DrawLineDrawing(Graphics g, LineDrawing lineDrawing) { Pen pen = new Pen(lineDrawing.color, lineDrawing.size); pen.StartCap = System.Drawing.Drawing2D.LineCap.Round; pen.EndCap = System.Drawing.Drawing2D.LineCap.Round; if (lineDrawing.listPoint.Count == 1) { SolidBrush brush = new SolidBrush(lineDrawing.color); Point location = lineDrawing.listPoint[0]; g.FillEllipse(brush, location.X - (float)lineDrawing.size / 2f, location.Y - (float)lineDrawing.size / 2f, lineDrawing.size, lineDrawing.size); return; } for (int i = 0; i < lineDrawing.listPoint.Count - 1; i++) { g.DrawLine(pen, lineDrawing.listPoint[i], lineDrawing.listPoint[i + 1]); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Draws the etched lines on the dialog. /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); SizeF spaceSize = e.Graphics.MeasureString(@"m", Font); int x1 = m_lblProjectName.Right + (int)spaceSize.Width; int x2 = btnHelp.Right; int y = (m_lblProjectName.Top + m_lblProjectName.Bottom) / 2; LineDrawing.Draw(e.Graphics, x1, y, x2, y); x1 = m_lblSpecifyWrtSys.Right + (int)spaceSize.Width; x2 = btnHelp.Right; y = (m_lblSpecifyWrtSys.Top + m_lblSpecifyWrtSys.Bottom) / 2; LineDrawing.Draw(e.Graphics, x1, y, x2, y); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Raises the paint event. /// </summary> /// <param name="e">The <see cref="T:System.Windows.Forms.PaintEventArgs"/> /// instance containing the event data.</param> /// ------------------------------------------------------------------------------------ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); LineDrawing.DrawDialogControlSeparator(e.Graphics, ClientRectangle, btnOK.Bounds); }
/// ----------------------------------------------------------------------------------- /// <summary> /// /// </summary> /// ----------------------------------------------------------------------------------- private void panSteps_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { if (m_stepText == null) { return; } // This is the minimum height a single text line will occupy. // (Note: this doesn't include the spacing between lines.) int dyStepHeight = Math.Max(m_font.Height, kdypStepSquareHeight); // This is the rectangle for the text of step one. Each subsequent step's // text rectangle will be calculated by increasing the rectangle's Y // property accordingly. 3 is added as the number of horizontal pixels // between the text and the colored square. Rectangle rcText = new Rectangle(kdxpStepListSpacing + kdxpStepSquareWidth + 3, kdypStepListSpacing, panSteps.Width - (kdxpStepListSpacing + kdxpStepSquareWidth + 3), dyStepHeight); // This is the distance between the top of a step text's rectangle // and the top of the colored square's rectangle. However, if the step // text's rectangle is shorter than the height of the square, the // padding will be zero. int dySquarePadding = (dyStepHeight > kdypStepSquareHeight) ? (dyStepHeight - kdypStepSquareHeight) / 2 : 0; // This is the rectangle for step one's colored square. Rectangle rcSquare = new Rectangle(kdxpStepListSpacing, kdypStepListSpacing + dySquarePadding, kdxpStepSquareWidth, kdypStepSquareHeight); StringFormat sf = new StringFormat(StringFormat.GenericTypographic); sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; // Calculate the horizontal position for the vertical connecting // line. (Subtracting 1 puts it just off center because the line // will be 2 pixels thick.) int xpConnectingLine = rcSquare.X + (kdxpStepSquareWidth / 2) - 1; // Create brushes for the colored squares and the step text. SolidBrush brSquare = new SolidBrush(kclrPendingStep); SolidBrush brText = new SolidBrush(m_foreColor); for (int i = 0; i < m_stepText.Length; i++) { e.Graphics.DrawString(m_stepText[i], m_font, brText, rcText, sf); rcText.Y += dyStepHeight + kdypStepListSpacing; // Determine what color the square should be. if (i == m_stepText.Length - 1) { brSquare.Color = kclrLastStep; } else if (i == m_currentStepNumber) { brSquare.Color = kclrCurrentStep; } else if (i < m_currentStepNumber) { brSquare.Color = kclrCompletedStep; } else { brSquare.Color = kclrPendingStep; } // Draw the square next to the step text label. e.Graphics.FillRectangle(brSquare, rcSquare); rcSquare.Y += (dyStepHeight + kdypStepListSpacing); // Draw the vertical line connecting each step's square. if (i < m_stepText.Length - 1) { LineDrawing line = new LineDrawing(e.Graphics); line.LineType = LineTypes.Solid; line.Draw(xpConnectingLine, rcSquare.Y - kdypStepListSpacing, xpConnectingLine, rcSquare.Y, kclrCompletedStep); line.Draw(xpConnectingLine + 1, rcSquare.Y - kdypStepListSpacing, xpConnectingLine + 1, rcSquare.Y, kclrPendingStep); } } }
/// <summary> /// 通过轮廓数据构建字体轮廓 /// </summary> /// <param name="outline">轮廓数据</param> /// <param name="offset">偏移量</param> /// <param name="wordNode"></param> /// <returns></returns> private WordOutlineDrawing BuildWordOutline(DOutline outline, PointF offset, TreeNode wordNode) { //获取轮廓大小 SizeF size = new SizeF(outline.Width, outline.Height); WordOutlineDrawing word = new WordOutlineDrawing(size); //--------------------- wordNode.Tag = word; //--------------------- int index = 0; //遍历填充轮廓数据 foreach (DPolygon p in outline.Polygons) { //新增多边形实例 PolygonDrawing polygon = new PolygonDrawing(); //--------------------- TreeNode polygonNode = new TreeNode("多边形" + (++index)); polygonNode.Tag = polygon; wordNode.Nodes.Add(polygonNode); //--------------------- //起始点 PointF start = new PointF(offset.X + ConvertUtil.FixedToFloat(p.Start.x), offset.Y - ConvertUtil.FixedToFloat(p.Start.y)); PointF point = start; foreach (DLine l in p.Lines) { LineDrawing line = null; //如果类型为1则为折线,为2则为曲线 if (l.Type == 1) { line = new PolylineDrawing(); } else { line = new CurvelineDrawing(); } //加入起始点 line.Points.Add(point); //--------------------- StringBuilder builder = new StringBuilder(l.Type == 1 ? "折" : "曲"); builder.AppendFormat(" ({0},{1}) ", point.X, point.Y); //--------------------- foreach (POINTFX fx in l.Points) { point = new PointF(offset.X + ConvertUtil.FixedToFloat(fx.x), offset.Y - ConvertUtil.FixedToFloat(fx.y)); Console.WriteLine("{0}.{1}, {2}.{3}({4},{5})", fx.x.value, fx.x.fract, fx.y.value, fx.y.fract, ConvertUtil.FixedToFloat(fx.x), ConvertUtil.FixedToFloat(fx.y)); line.Points.Add(point); builder.AppendFormat("({0},{1}) ", point.X, point.Y); } polygon.Lines.Add(line); //--------------------- TreeNode lineNode = new TreeNode(builder.ToString()); lineNode.Tag = line; polygonNode.Nodes.Add(lineNode); //--------------------- } if (point != start) { //增加结束到开始的闭合线段 LineDrawing endLine = new BeelineDrawing(); endLine.Points.Add(point); endLine.Points.Add(start); polygon.Lines.Add(endLine); //--------------------- TreeNode endNode = new TreeNode(string.Format("直 ({0},{1}) ({0},{1}) ", point.X, point.Y, start.X, start.Y)); endNode.Tag = endLine; polygonNode.Nodes.Add(endNode); //--------------------- } //加入到字符轮廓的多边形列表中 word.Polygons.Add(polygon); } return(word); }