Exemplo n.º 1
0
		public BaseCircleItem()
		{
			this.thickness = 1;
			this.dashStyle = DashStyle.Solid;
			this.Size = new Size(GlobalValues.PreferedSize.Width,2* GlobalValues.PreferedSize.Height);
			TypeDescriptor.AddProvider(new RectangleItemTypeProvider(), typeof(BaseCircleItem));
		}
Exemplo n.º 2
0
 /// <summary>
 /// Constructor for a line style with the specified color that
 /// will be displayed with a width of 1 pixel.
 /// </summary>
 /// <param name="col">The display color</param>
 /// <param name="style">The line style</param>
 internal LineStyle(Color col, DashStyle style)
     : base(col)
 {
     m_Style = style;
     m_Weight = -1.0;
     m_Pattern = null;
 }
Exemplo n.º 3
0
 public Pen GetPen(Color color, float width = 1, DashStyle style = DashStyle.Solid)
 {
     var desc = new PenDescriber(width, color, style);
     Pen pen;
     if (pens.TryGetValue(desc, out pen)) return pen;
     pen = new Pen(color);
     if (width != 1) pen.Width = width;
     if (style != DashStyle.Solid)
     {
         pen.DashStyle = style;
         switch (pen.DashStyle)
         {
             case DashStyle.Dot:
                 pen.DashPattern = defaultDotPattern;
                 break;
             case DashStyle.Dash:
                 pen.DashPattern = defaultDashPattern;
                 break;
             case DashStyle.DashDot:
                 pen.DashPattern = defaultDashDotPattern;
                 break;
             default:
                 pen.DashPattern = defaultDashDotDotPattern;
                 break;
         }
     }
     pens.Add(desc, pen);
     return pen;
 }
Exemplo n.º 4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="PenEx"/> class with the Width.  
		/// </summary>
		/// <param name="color">The <see cref="Color"/> of the <see cref="PenEx"/>.</param>
		/// <param name="width"></param>
		public PenEx(Color color, int width)
		{
			this.color = color;
			this.penStyle = DashStyle.Solid;
			this.width = width;
			hPen = GDIPlus.CreatePen((int)penStyle, width, ColorTranslator.ToWin32(color) /*GDIPlus.RGB(color)*/);
		}
        public static DashStyle GetLineStypefromString(string LineStyleIn)
        {
            DashStyle DashStyleOut = new DashStyle();

            switch (LineStyleIn)
            {
                case "Solid":
                    DashStyleOut = DashStyle.Solid;
                    break;
                case "Dash":
                    DashStyleOut = DashStyle.Dash;
                    break;
                case "DashDot":
                    DashStyleOut = DashStyle.DashDot;
                    break;
                case "DashDotDot":
                    DashStyleOut = DashStyle.DashDotDot;
                    break;
                case "Dot":
                    DashStyleOut = DashStyle.Dot;
                    break;
                default:
                    DashStyleOut = DashStyle.Solid;
                    break;
            }
            return DashStyleOut;
        }
Exemplo n.º 6
0
		/// <summary>
		/// Initializes a new instance of the <see cref="PenEx"/> class with the <see cref="DashStyle"/>.
		/// </summary>
		/// <param name="color">The <see cref="Color"/> of the <see cref="PenEx"/>.</param>
		/// <param name="style"></param>
		public PenEx(Color color, DashStyle style)
		{
			this.color = color;
			this.penStyle = style;
			this.width = 1;
			hPen = GDIPlus.CreatePen((int)style, width, ColorTranslator.ToWin32(color)/*GDIPlus.RGB(color)*/);
		}
Exemplo n.º 7
0
 /// <summary>
 /// Constructor for a style where lines will be displayed with the
 /// specified line weight.
 /// </summary>
 /// <param name="col">The display colour</param>
 /// <param name="wt">The line weight (in meters on the ground)</param>
 /// <param name="dp">Any dashed line pattern that should be used (null
 /// for a solid line</param>
 internal LineStyle(Color col, double wt, DashPattern dp)
     : base(col)
 {
     m_Weight = wt;
     m_Pattern = dp;
     m_Style = (m_Pattern==null ? DashStyle.Solid : DashStyle.Custom);
 }
Exemplo n.º 8
0
        public ColorToolControl(bool fillMode = false)
        {
            _selectedColor = Color.Black;
            _selectedWidth = 2F;
            _selectedDash = DashStyle.Solid;

            InitializeComponent(fillMode);
        }
Exemplo n.º 9
0
		public BaseLineItem()
		{
			this.thickness = 1;
			this.dashStyle = DashStyle.Solid;
			this.Size = new Size(50,10);
			TypeDescriptor.AddProvider(new LineItemTypeProvider(), typeof(BaseLineItem));
			this.SetStartEndPoint();
		}
Exemplo n.º 10
0
 // Methods
 public static void DrawSamplePen(Graphics gr, Rectangle sample_bounds, Color line_color, DashStyle line_style)
 {
     int y = sample_bounds.Y + (sample_bounds.Height / 2);
     using (Pen line_pen = new Pen(Color.Black, 2f))
     {
         line_pen.DashStyle = line_style;
         gr.DrawLine(line_pen, sample_bounds.Left + 1, y, sample_bounds.Right - 1, y);
     }
 }
Exemplo n.º 11
0
 public void Create(Color color, float width, DashStyle dashStyle)
 {
     Control = new PenData
     {
         Color = color,
         Width = width,
         DashStyle = dashStyle,
     };
 }
Exemplo n.º 12
0
 public Function(StringBuilder name, Color color, DashStyle LineStyle, char Argument)
 {
     this.name = name;
     RPNsequence = new string[name.Length];
     this.color = color;
     this.LineStyle = LineStyle;
     this.Argument = Argument;
     ConvertToRPN();
 }
Exemplo n.º 13
0
        public LogicLine(PointF point1, PointF point2, Color color, DashStyle lineType)
        {
            this.Type = LogicObjectType.Line;

            this.point1 = point1;
            this.point2 = point2;
            this.ForeColor = color;
            this.lineType = lineType;
            this.length = this.GetLength();
        }
Exemplo n.º 14
0
 public LinkLine(Font font)
 {
     this.LineColor = Color.DarkGray;
     LineStyle = System.Drawing.Drawing2D.DashStyle.Solid;
     Font = font;
     //StartText = "";
     //EndText = "";
     MiddleText = "";
     this.Font = new Font(this.Font.FontFamily.Name, 7F);
 }
Exemplo n.º 15
0
 public void SetLineStyle(DashStyle style)
 {
     for (int i = 0; i < this.lineStyleArr.Length; i++)
     {
         if(this.lineStyleArr[i] == style)
         {
             this.selected = i;
         }
     }
     this.Invalidate();
 }
Exemplo n.º 16
0
        public LifeViewer()
        {
            this.DoubleBuffered = true;

            this.fOptions = new LifeOptions();
            this.fRules = new LifeRules();
            this.fGrid = new LifeGrid(LifeConsts.DefaultGridWidth, LifeConsts.DefaultGridHeight);
            this.fHistory = new LifeHistory(LifeConsts.DefaultNumberOfHistoryLevels);
            this.fGridLineColor = LifeConsts.DefaultGridLineColor;
            this.fGridLineStyle = LifeConsts.DefaultGridLineStyle;
        }
Exemplo n.º 17
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="point1">点1坐标</param>
        /// <param name="point2">点2坐标</param>
        /// <param name="color">颜色</param>
        /// <param name="lineType">线型</param>
        /// <param name="dynamics">动态属性</param>
        public LogicLine(PointF point1, PointF point2, Color color, DashStyle lineType, params string[] dynamics)
            : base(dynamics)
        {
            this.Type = LogicObjectType.Line;

            this.point1 = point1;
            this.point2 = point2;
            this.ForeColor = color;
            this.lineType = lineType;
            this.length = this.GetLength();
        }
Exemplo n.º 18
0
 public LinkLine(Font font, DashStyle lineStyle, string startText, string middleText, string endText, CustomLineCap startCap, CustomLineCap endCap)
 {
     this.LineColor = Color.DarkGray;
     LineStyle = lineStyle;
     Font = font;
     //StartText = startText;
     //EndText = endText;
     MiddleText = middleText;
     StartCap = startCap;
     EndCap = endCap;
     this.Font = new Font(this.Font.FontFamily.Name, 7F);
 }
        public static void DrawControlLine(IGraphics g, Color c, DashStyle style, Coordinates loc1, Coordinates loc2, WorldTransform wt)
        {
            float pw = 1.25f / wt.Scale;

            using (IPen p = g.CreatePen()) {
                p.Color = c;
                p.Width = pw;
                p.DashStyle = style;

                g.DrawLine(p, Utility.ToPointF(loc1), Utility.ToPointF(loc2));
            }
        }
Exemplo n.º 20
0
		public Pen (Brush brush, float width)
		{
			_brush = (Brush)brush.Clone();;
			_width = width;
			_dashStyle = DashStyle.Solid;
			_startCap = LineCap.Flat;
			_dashCap = DashCap.Flat;
			_endCap = LineCap.Flat;
			_alignment = PenAlignment.Center;
			_lineJoin = LineJoin.Miter;
			_miterLimit = 10f;
			_transform = new Matrix();
		}
Exemplo n.º 21
0
		public BaseLine(Color color, DashStyle dashStyle,float thickness, LineCap startLineCap, LineCap endLineCap, DashCap dashLineCap)
		{
			if (color == Color.White) {
				this.color = Color.Black;
			}
			
			this.color = color;
			this.dashStyle = dashStyle;
			this.thickness = thickness;
			this.startLineCap = startLineCap;
			this.endLineCap = endLineCap;
			this.dashLineCap = dashLineCap;
		}
Exemplo n.º 22
0
        public Shape(int Type, int Fill, Point startPoint, Point endPoint, Color fillColor, Color borderColor, DashStyle borderStyle, int borderWidth )
        {
            this.Type = Type;
            this.Fill = Fill;

            this.startPoint = startPoint;
            this.endPoint = endPoint;

            this.Pen = new Pen(borderColor, borderWidth);
            this.Pen.DashStyle = borderStyle;

            this.Brush = new SolidBrush(fillColor);
        }
Exemplo n.º 23
0
		static Pen GetPen (Generator generator, Color color, float thickness = 1f, DashStyle dashStyle = null)
		{
			var cache = generator.Cache<PenKey, Pen> (cacheKey);
			Pen pen;
			lock (cache) {
				var key = new PenKey (color.ToArgb (), thickness, dashStyle);
				if (!cache.TryGetValue (key, out pen)) {
					pen = new Pen (color, thickness, generator);
					if (dashStyle != null) pen.DashStyle = dashStyle;
					cache.Add (key, pen);
				}
			}
			return pen;
		}
Exemplo n.º 24
0
        public PolygonProperties(Color lineColor, int lineSize, DashStyle lineDashStyle, Color symbolColor, int symbolSize,
			int symbolType, bool horizErrors, bool vertErrors, int errorLineWidth, int errorSize)
        {
            LineColor = lineColor;
            LineWidth = lineSize;
            LineDashStyle = lineDashStyle;
            SymbolColor = symbolColor;
            SymbolSize = symbolSize;
            SymbolType = symbolType;
            HorizErrors = horizErrors;
            VertErrors = vertErrors;
            ErrorLineWidth = errorLineWidth;
            ErrorSize = errorSize;
        }
Exemplo n.º 25
0
 /// <summary>
 /// Constructor without the flag whether this property is logging.
 /// </summary>
 /// <param name="modelID">the model ID</param>
 /// <param name="id">the object key.</param>
 /// <param name="type">the object type.</param>
 /// <param name="fullPN">the FullPN.</param>
 public LoggerEntry(string modelID, string id, string type, string fullPN)
 {
     this.m_modelID = modelID;
     this.m_ID = id;
     this.m_Type = type;
     this.m_FullPN = fullPN;
     this.m_color = Color.Black;
     this.m_lineStyle = DashStyle.Solid;
     this.m_lineWidth = 2;
     this.m_isShown = true;
     this.m_isY2 = false;
     this.m_isLoaded = false;
     this.m_filename = null;
 }
Exemplo n.º 26
0
		public Pen GetDashPen (Color color, DashStyle dashStyle)
		{
			string hash = color.ToString() + dashStyle;

			lock (dashpens) {
				Pen res = dashpens [hash] as Pen;
				if (res != null)
					return res;
			
				Pen pen = new Pen (color);
				pen.DashStyle = dashStyle;
				dashpens [hash] = pen;
				return pen;
			}
		}
Exemplo n.º 27
0
	// Map the line style from "System.Drawing" to "Xsharp".
	private static LineStyle MapLineStyle(DashStyle style)
			{
				switch(style)
				{
					case DashStyle.Solid:
					default:
						return LineStyle.LineSolid;
					case DashStyle.Custom:
					case DashStyle.Dash:
					case DashStyle.Dot:
					case DashStyle.DashDot:
					case DashStyle.DashDotDot:
						return LineStyle.LineOnOffDash;
				}
			}
Exemplo n.º 28
0
        // Map the line style from "System.Drawing" to "Xsharp".
        private static LineStyle MapLineStyle(DashStyle style)
        {
            switch (style)
            {
            case DashStyle.Solid:
            default:
                return(LineStyle.LineSolid);

            case DashStyle.Custom:
            case DashStyle.Dash:
            case DashStyle.Dot:
            case DashStyle.DashDot:
            case DashStyle.DashDotDot:
                return(LineStyle.LineOnOffDash);
            }
        }
        public void SetThickness(double t)
        {
            var ds = Pen.DashStyle;

            if (ds != DashStyles.Solid)
            {
                var dashes = Pen.DashStyle.Dashes.Clone();
                for (int n = 0; n < dashes.Count; n++)
                {
                    dashes[n] = (dashes[n] * Pen.Thickness) / t;
                }
                var offset = (Pen.DashStyle.Offset * Pen.Thickness) / t;
                ds = new DashStyle(dashes, offset);
            }
            AllocatePen(colorBrush.Color, t, ds);
        }
Exemplo n.º 30
0
        public HinhTamGiac(Color mauve, int dodamnet, DashStyle kieubutve)
            : base(mauve, dodamnet, kieubutve)
        {
            LoaiHinh        = 4;
            SoDiemDieuKhien = 8;
            DiemBatDau.X    = 0; DiemBatDau.Y = 0;
            DiemKetThuc.X   = 0; DiemKetThuc.Y = 1;
            Pen pen = new Pen(MauVe, DoDamNet);

            pen.DashStyle = KieuButVe;
            GraphicsPath  = new GraphicsPath();
            GraphicsPath.AddRectangle(new Rectangle(0, 0, 0, 1));
            GraphicsPath.Widen(pen);
            KhuVuc = new Region(new Rectangle(0, 0, 0, 1));
            KhuVuc.Union(GraphicsPath);
        }
Exemplo n.º 31
0
        private void DrawCenter(Graphics canvas, Pen pen, Point center)
        {
            // Precision center.
            float     memoPenWidth = pen.Width;
            DashStyle memoPenDash  = pen.DashStyle;

            pen.Width     = 1.0f;
            pen.DashStyle = DashStyle.Solid;
            Point c = center;

            canvas.DrawLine(pen, center.X - crossRadius, center.Y, center.X + crossRadius, center.Y);
            canvas.DrawLine(pen, center.X, center.Y - crossRadius, center.X, center.Y + crossRadius);

            pen.Width     = memoPenWidth;
            pen.DashStyle = memoPenDash;
        }
Exemplo n.º 32
0
 // Methods
 public LineStyleListBox(DashStyle line_style, IWindowsFormsEditorService editor_service)
 {
     base.DrawItem += new DrawItemEventHandler(this.LineStyleListBox_DrawItem);
     base.Click += new EventHandler(this.LineStyleListBox_Click);
     this.m_EditorService = editor_service;
     int i = 0;
     do
     {
         this.Items.Add(i);
         i++;
     }
     while (i <= 4);
     this.SelectedIndex = (int)line_style;
     this.DrawMode = DrawMode.OwnerDrawFixed;
     this.ItemHeight = 0x12;
 }
Exemplo n.º 33
0
        public override void DrawShapes(Camera cam)
        {
            _parent ??= transform.parent;
            var bot = new Vector3(_parent.position.x, 0, _parent.position.z);

            using (Draw.Command(cam))
            {
                Draw.BlendMode    = ShapesBlendMode.Screen;
                Draw.DiscGeometry = DiscGeometry.Flat2D;
                Draw.Matrix       = Matrix4x4.TRS(bot, Quaternion.Euler(90, 0, 0), Vector3.one);
                Draw.Color        = Color.white;
                Draw.Thickness    = 3;
                Draw.DashStyle    = DashStyle.MeterDashes(DashType.Basic, 2, 2);
                Draw.UseDashes    = true;
                Draw.Ring(Vector3.zero, Quaternion.identity, 55);
            }
        }
Exemplo n.º 34
0
        private void lineComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (lineComboBox.SelectedIndex)
            {
            case 0:
                line = DashStyle.Solid;
                break;

            case 1:
                line = DashStyle.Dash;
                break;

            default:
                line = DashStyle.DashDot;
                break;
            }
        }
 public static DashStyle NextDashStyle(this Random random)
 {
     if (random is null)
     {
         throw new ArgumentNullException(nameof(random));
     }
     DashStyle[] allValues = new DashStyle[]
     {
         DashStyle.Custom,
         DashStyle.Dash,
         DashStyle.DashDot,
         DashStyle.DashDotDot,
         DashStyle.Dot,
         DashStyle.Solid,
     };
     return(allValues[random.Next(allValues.Length)]);
 }
Exemplo n.º 36
0
        public static float[] GetPattern(DashStyle dashStyle)
        {
            switch (dashStyle)
            {
            case DashStyle.Dash:
                return(Dash);

            case DashStyle.Dot:
                return(Dot);

            case DashStyle.DashDot:
                return(DashDot);

            default:
                return(Dash);
            }
        }
Exemplo n.º 37
0
        // ========================================
        // method
        // ========================================
        public override void Execute()
        {
            var node = _target.Figure as INode;

            if (node != null)
            {
                _oldIsBorderEnabled = node.IsForegroundEnabled;
                _oldBorderColor     = node.Foreground;
                _oldBorderWidth     = node.BorderWidth;
                _oldBorderDashStyle = node.BorderDashStyle;

                node.IsForegroundEnabled = _newIsBorderEnabled;
                node.Foreground          = _newBorderColor;
                node.BorderWidth         = _newBorderWidth;
                node.BorderDashStyle     = _newBorderDashStyle;
            }
        }
Exemplo n.º 38
0
        private void bttnOk_Click(object sender, EventArgs e)
        {
            int ind = comboBoxName.SelectedIndex;

            ZedGraph.LineItem curve = (ZedGraph.LineItem)_curves[ind];
            curve.Label.Text = textBox1.Text;
            curve.Color      = pnlColor.BackColor;
            ZedGraph.SymbolType SmType = (ZedGraph.SymbolType)Enum.Parse(typeof(ZedGraph.SymbolType), ComBoxSymType.Items[ComBoxSymType.SelectedIndex].ToString());
            curve.Symbol = new ZedGraph.Symbol(SmType, pnlColor.BackColor);
            DashStyle Dash = (DashStyle)Enum.Parse(typeof(DashStyle), ComBoxLine.Items[ComBoxLine.SelectedIndex].ToString());

            curve.Line.Style = Dash;

            bttnOk.Enabled = false;
            EventChangedCurve();
            LoadList(ind);
        }
Exemplo n.º 39
0
 public static int DashStyleToIndex(DashStyle dashStyle)
 {
     switch (dashStyle){
         case DashStyle.Solid:
             return 0;
         case DashStyle.Dash:
             return 1;
         case DashStyle.Dot:
             return 2;
         case DashStyle.DashDot:
             return 3;
         case DashStyle.DashDotDot:
             return 4;
         default:
             throw new ArgumentException();
     }
 }
Exemplo n.º 40
0
Arquivo: Theme.cs Projeto: yonder/mono
        public Pen GetDashPen(Color color, DashStyle dashStyle)
        {
            string hash = color.ToString() + dashStyle;

            lock (dashpens) {
                Pen res = dashpens [hash] as Pen;
                if (res != null)
                {
                    return(res);
                }

                Pen pen = new Pen(color);
                pen.DashStyle   = dashStyle;
                dashpens [hash] = pen;
                return(pen);
            }
        }
Exemplo n.º 41
0
 public StrokeStyleProperties(
     CapStyle startCap   = CapStyle.Flat,
     CapStyle endCap     = CapStyle.Flat,
     CapStyle dashCap    = CapStyle.Flat,
     LineJoin lineJoin   = LineJoin.Miter,
     float miterLimit    = 0.0f,
     DashStyle dashStyle = DashStyle.Solid,
     float dashOffset    = 0.0f)
 {
     StartCap   = startCap;
     EndCap     = endCap;
     DashCap    = dashCap;
     LineJoin   = lineJoin;
     MiterLimit = miterLimit;
     DashStyle  = dashStyle;
     DashOffset = dashOffset;
 }
        public SimplePaint()
        {
            InitializeComponent();


            KeyPreview  = true;
            myColor     = Color.Black;
            myFillColor = Color.Black;
            thick       = 1;
            Dstyle      = DashStyle.Solid;
            cmbShapeMode.SelectedIndex  = 0;
            cmbbrushStyle.SelectedIndex = 0;
            cmbDashMode.SelectedIndex   = 0;
            cmbShapeMode.SelectedIndex  = 0;
            Fill          = false;
            isMouseSelect = false;
        }
Exemplo n.º 43
0
        public static DoubleCollection DashStyleToCollection(DashStyle dashStyle)
        {
            const int        lDash  = 8;
            const int        lDot   = 1;
            const int        lSpace = 4;
            DoubleCollection dc     = null;

            switch (dashStyle)
            {
            case DashStyle.Solid:
                break;

            case DashStyle.Dash:
                dc = new DoubleCollection()
                {
                    lDash, lSpace
                };
                break;

            case DashStyle.Dot:
                dc = new DoubleCollection()
                {
                    lDot, lSpace
                };
                break;

            case DashStyle.DashDot:
                dc = new DoubleCollection()
                {
                    lDash, lSpace, lDot, lSpace
                };
                break;

            case DashStyle.DashDotDot:
                dc = new DoubleCollection()
                {
                    lDash, lSpace, lDot, lSpace, lDot, lSpace
                };
                break;

            default:
                System.Diagnostics.Debug.Assert(false, "Unknown dash style");
                break;
            }
            return(dc);
        }
Exemplo n.º 44
0
        /// <summary>
        /// Adding new <see cref="Button"/> to this <see cref="TableLayoutPanel"/> for chosing dash style
        /// of the drawable figure.
        /// </summary>
        /// <param name="name">The string that will be used as the name of the <see cref="ComboBox"/>.</param>
        /// <param name="dashStyle">The dash style of drawable figure.</param>
        private void AddDashStyleComboBox(string name, DashStyle dashStyle)
        {
            ComboBox comboBox = new ComboBox()
            {
                Name          = name + ComboBoxPostfix,
                DropDownStyle = ComboBoxStyle.DropDownList
            };

            comboBox.Items.Add(DashStyle.Dash);
            comboBox.Items.Add(DashStyle.DashDot);
            comboBox.Items.Add(DashStyle.DashDotDot);
            comboBox.Items.Add(DashStyle.Dot);
            comboBox.Items.Add(DashStyle.Solid);
            comboBox.SelectedItem = dashStyle;

            this.TableLayoutPanel.Controls.Add(comboBox);
        }
Exemplo n.º 45
0
        public static string AsString(this DashStyle dashStyle)
        {
            if (dashStyle == DashStyles.DashDot)
            {
                return(DashDot);
            }
            if (dashStyle == DashStyles.Dash)
            {
                return(Dash);
            }
            if (dashStyle == DashStyles.Dot)
            {
                return(Dot);
            }

            return(Solid);
        }
Exemplo n.º 46
0
        /// <summary>
        /// Paints one color button
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="color"></param>
        /// <param name="hotTrack"></param>
        /// <param name="selected"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        private Rectangle PaintLine(Graphics graphics, DashStyle style, bool hotTrack, bool selected, int x, int y)
        {
            // Button inside rectangle
            RectangleF mainRec = new RectangleF(x + 3, y + 3, 100, 1.5F);
            // Button border rectangle
            Rectangle borderRec = new Rectangle(x, y, 102, 10);
            // Check if the button is selected and HotTrack ( no the same color)
            bool selectedAndHotTrack = selected && hotTrack;

            // Paints the button using the brushes needed

            using (Brush hotTrackBrush = new SolidBrush(ArtPalette.ButtonHoverLight))
                using (Brush selectedBrush = new SolidBrush(ArtPalette.ButtonHoverDark))
                    using (Brush selectedHotTrackBrush = new SolidBrush(ArtPalette.SelectedAndHover))
                        using (Pen selectedPen = new Pen(ArtPalette.SelectedBorder))
                            using (Pen linePen = new Pen(Color.DimGray, 2F))
                                using (Pen borderPen = new Pen(ArtPalette.ButtonBorder))
                                {
                                    linePen.DashStyle = style;
                                    // Paints the rectangle with the Track/Selected color
                                    // if this color is selected/hottrack
                                    if (selectedAndHotTrack)
                                    {
                                        graphics.FillRectangle(selectedHotTrackBrush, borderRec);
                                        graphics.DrawRectangle(selectedPen, borderRec);
                                    }
                                    else if (hotTrack)
                                    {
                                        graphics.FillRectangle(hotTrackBrush, borderRec);
                                        graphics.DrawRectangle(selectedPen, borderRec);
                                    }
                                    else if (selected)
                                    {
                                        graphics.FillRectangle(selectedBrush, borderRec);
                                        graphics.DrawRectangle(selectedPen, borderRec);
                                    }
                                    // Fills the rectangle with the current color, paints
                                    // the background.
                                    graphics.DrawLine(linePen, x + 2, y + 4, x + 100, y + 4);
                                    graphics.DrawString(style.ToString(), this.Font, Brushes.DimGray, x + 104, y - 1);
                                    //graphics.FillRectangle(Brushes.DimGray, mainRec);
                                    //graphics.DrawRectangle(borderPen, Rectangle.Round( mainRec));
                                }
            return(borderRec);
        }
Exemplo n.º 47
0
 private void listBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
 {
     try
     {
         if (editStyle == EditStyle.dash)
         {
             DashStyle style = (DashStyle)listBox1.Items[e.Index];
             using (Pen pen = new Pen(Color.Black, 2))
             {
                 if (style == (DashStyle)_style)
                 {
                     using (SolidBrush brush = new SolidBrush(Color.Aqua))
                     {
                         e.Graphics.FillRectangle(brush, e.Bounds);
                     }
                 }
                 pen.DashStyle = style;
                 e.Graphics.DrawLine(pen, 5, e.Bounds.Top + listBox1.ItemHeight / 2, e.Bounds.Width - 10, e.Bounds.Top + listBox1.ItemHeight / 2);
             }
         }
         else if (editStyle == EditStyle.hatch)
         {
             HatchStyle style = (HatchStyle)listBox1.Items[e.Index];
             using (HatchBrush hbrush = new HatchBrush(style, Color.Black, Color.Transparent))
             {
                 if (style == (HatchStyle)_style)
                 {
                     using (SolidBrush brush = new SolidBrush(Color.Aqua))
                     {
                         e.Graphics.FillRectangle(brush, e.Bounds);
                     }
                 }
                 Rectangle rect = new Rectangle(e.Bounds.X + 5, e.Bounds.Y + 5, e.Bounds.Width - 10, e.Bounds.Height - 10);
                 using (Pen pen = new Pen(Color.Black))
                 {
                     e.Graphics.DrawRectangle(pen, rect);
                 }
                 e.Graphics.FillRectangle(hbrush, rect);
             }
         }
     }
     catch
     {
     }
 }
Exemplo n.º 48
0
        private void DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            e.DrawBackground();
            pen.Color = colorLabel.BackColor;
            Graphics g     = e.Graphics;
            string   style = (string)lineStyle.Items[e.Index];

            for (DashStyle s = DashStyle.Solid; s < DashStyle.Custom; s++)
            {
                if (style == s.ToString())
                {
                    pen.DashStyle = s;
                }
            }
            g.DrawLine(pen, e.Bounds.X, e.Bounds.Y + e.Bounds.Height / 2, e.Bounds.X + e.Bounds.Width,
                       e.Bounds.Y + e.Bounds.Height / 2);
            e.DrawFocusRectangle();
        }
Exemplo n.º 49
0
        public DuongCong(Color mauve, int dodamnet, DashStyle kieubutve)
            : base(mauve, dodamnet, kieubutve)
        {
            LoaiHinh        = 1;
            SoDiemDieuKhien = 4;
            Diem            = new Point[5];
            Diem[1].X       = 0; Diem[1].Y = 0;
            Diem[2].X       = 0; Diem[2].Y = 1;
            Diem[3].X       = 0; Diem[3].Y = 2;
            Diem[4].X       = 0; Diem[4].Y = 3;
            Pen pen = new Pen(MauVe, DoDamNet);

            pen.DashStyle = KieuButVe;
            GraphicsPath  = new GraphicsPath();
            GraphicsPath.AddBezier(Diem[1], Diem[2], Diem[3], Diem[4]);
            GraphicsPath.Widen(pen);
            KhuVuc = new Region(GraphicsPath);
        }
Exemplo n.º 50
0
 public Hinh(Color mauve, int dodamnet, DashStyle kieubutve, Point diembatdau, Point diemketthuc, Point diemnhanchuot,
             int sodiemdieukhien, GraphicsPath graphicspath, Region khuvuc, int vitrisovoihinh,
             bool isdichuyen, bool isthaydoikichthuoc, int loaihinh)
 {
     LoaiHinh           = loaihinh;
     SoDiemDieuKhien    = sodiemdieukhien;
     DiemBatDau         = diembatdau;
     DiemKetThuc        = diemketthuc;
     MauVe              = mauve;
     DoDamNet           = dodamnet;
     KieuButVe          = kieubutve;
     GraphicsPath       = graphicspath;
     KhuVuc             = khuvuc;
     DiemNhanChuot      = diemnhanchuot;
     ViTriSoVoiHinh     = vitrisovoihinh;
     IsDiChuyen         = isdichuyen;
     IsThayDoiKichThuoc = isthaydoikichthuoc;
 }
Exemplo n.º 51
0
        public Pen Pen(Color color, DashStyle dashStyle, float width)
        {
            this.m_StringBuilder.Length = 0;
            this.m_StringBuilder.Append(color.GetHashCode().ToString());
            this.m_StringBuilder.Append(dashStyle.ToString());
            this.m_StringBuilder.Append("W");
            this.m_StringBuilder.Append(width.ToString());
            string key = this.m_StringBuilder.ToString();
            Pen    pen = this.m_CachePens[key] as Pen;

            if (pen == null)
            {
                pen           = new Pen(color, width);
                pen.DashStyle = dashStyle;
                this.m_CachePens.Add(key, pen);
            }
            return(pen);
        }
Exemplo n.º 52
0
        internal int DashStyleToPenStyle(DashStyle style)
        {
            switch (style)
            {
            case DashStyle.Dash:
                return(1);

            case DashStyle.Dot:
                return(2);

            case DashStyle.DashDot:
                return(3);

            case DashStyle.DashDotDot:
                return(4);
            }
            return(0);
        }
Exemplo n.º 53
0
        public virtual Figure EnableDragFeedback(bool isFeedbackEnabled)
        {
            if (isFeedbackEnabled)
            {
                _storedDashStyle = DashStyle;
                _storedFillColor = FillColor;
                FillColor        = FillColor.AdjustOpacity(0.5);
            }
            else
            {
                FillColor = _storedFillColor;
            }


            Canvas?.NeedsRepaint(this);

            return(this);
        }
Exemplo n.º 54
0
 private Int32 computeHashCode()
 {
     return(Alignment.GetHashCode() ^
            getSingleArrayHashCode(CompoundArray) ^
            MiterLimit.GetHashCode() ^
            BackgroundBrush.GetHashCode() ^
            DashOffset.GetHashCode() ^
            getSingleArrayHashCode(DashPattern) ^
            getStyleBrushesArrayHashCode(DashBrushes) ^
            DashStyle.GetHashCode() ^
            StartCap.GetHashCode() ^
            EndCap.GetHashCode() ^
            DashCap.GetHashCode() ^
            LineJoin.GetHashCode() ^
            Transform.GetHashCode() ^
            Width.GetHashCode() ^
            -18133844);
 }
Exemplo n.º 55
0
        public void DrawRectangle(Color penColor, DashStyle dashStyle, double penWidth, MyVector lowerCorner, MyVector upperCorner)
        {
            try
            {
                using (Pen pen = new Pen(penColor, DistWToV(penWidth)))
                {
                    pen.DashStyle = dashStyle;

                    _graphics.DrawRectangle(pen,
                                            PosWToV_X(lowerCorner.X), PosWToV_Y(lowerCorner.Y),
                                            DistWToV(upperCorner.X - lowerCorner.X), DistWToV(upperCorner.Y - lowerCorner.Y));
                }
            }
            catch (OverflowException)
            {
                // Oh well
            }
        }
Exemplo n.º 56
0
 private void ComboBoxPens_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxPens.SelectedIndex == 0)
     {
         _ds = DashStyle.Dot;
         ButtonLines_Click(sender, e);
     }
     else if (comboBoxPens.SelectedIndex == 1)
     {
         _ds = DashStyle.Solid;
         ButtonLines_Click(sender, e);
     }
     else if (comboBoxPens.SelectedIndex == 2)
     {
         _ds = DashStyle.Dash;
         ButtonLines_Click(sender, e);
     }
 }
Exemplo n.º 57
0
        /// <summary>
        /// Draw a polygon
        /// </summary>
        /// <param name="p"></param>
        /// <param name="c"></param>
        /// <param name="d"></param>
        /// <param name="g"></param>
        /// <param name="wt"></param>
        public static void DrawControlPolygon(Polygon p, Color c, DashStyle d, Graphics g, WorldTransform wt)
        {
            // points of poly
            List <Coordinates> points = p.points;

            // loop and draw
            for (int i = 0; i < points.Count; i++)
            {
                if (i == points.Count - 1)
                {
                    DrawColoredControlLine(c, d, points[i], points[0], g, wt);
                }
                else
                {
                    DrawColoredControlLine(c, d, points[i], points[i + 1], g, wt);
                }
            }
        }
        public Line(int x1, int y1, int x2, int y2, Graphics graph, Color penColor, int penWidth, LineCap?startArrow = null, LineCap?endArrow = null, DashStyle?lineStyle = null)
        {
            Brush brushForPen = new SolidBrush(penColor);

            this._x1 = x1;
            this._y1 = y1;
            this._x2 = x2;
            this._y2 = y2;

            this._startArrow = startArrow ?? this._startArrow;
            this._endArrow   = endArrow ?? this._endArrow;
            this._lineStyle  = lineStyle ?? this._lineStyle;
            this._graph      = graph;

            this._pen           = new Pen(brushForPen, penWidth);
            this._pen.StartCap  = this._startArrow;
            this._pen.EndCap    = this._endArrow;
            this._pen.DashStyle = this._lineStyle;
        }
Exemplo n.º 59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="color">The stroke color.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="dashCap">The dash cap.</param>
 /// <param name="startLineCap">The start line cap.</param>
 /// <param name="endLineCap">The end line cap.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     uint color,
     double thickness        = 1.0,
     DashStyle dashStyle     = null,
     PenLineCap dashCap      = PenLineCap.Flat,
     PenLineCap startLineCap = PenLineCap.Flat,
     PenLineCap endLineCap   = PenLineCap.Flat,
     PenLineJoin lineJoin    = PenLineJoin.Miter,
     double miterLimit       = 10.0)
 {
     Brush        = new SolidColorBrush(color);
     Thickness    = thickness;
     StartLineCap = startLineCap;
     EndLineCap   = endLineCap;
     LineJoin     = lineJoin;
     MiterLimit   = miterLimit;
     DashStyle    = dashStyle;
     DashCap      = dashCap;
 }
Exemplo n.º 60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="color">The stroke color.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="dashCap">The dash cap.</param>
 /// <param name="startLineCap">The start line cap.</param>
 /// <param name="endLineCap">The end line cap.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     uint color, 
     double thickness = 1.0,
     DashStyle dashStyle = null, 
     PenLineCap dashCap = PenLineCap.Flat, 
     PenLineCap startLineCap = PenLineCap.Flat,
     PenLineCap endLineCap = PenLineCap.Flat, 
     PenLineJoin lineJoin = PenLineJoin.Miter, 
     double miterLimit = 10.0)
 {
     Brush = new SolidColorBrush(color);
     Thickness = thickness;
     StartLineCap = startLineCap;
     EndLineCap = endLineCap;
     LineJoin = lineJoin;
     MiterLimit = miterLimit;
     DashStyle = dashStyle;
     DashCap = dashCap;
 }