Exemple #1
0
        /// <summary>
        /// Get header stroke
        /// </summary>
        /// <returns>sroke value in string</returns>
        public DashStyle GetHeader_Stroke()
        {
            float width = (float)GetHdrStroke();

            if (GetHdrStrokeType() == null || HDRSTROKETYPE_SolidLine.Equals(GetHdrStrokeType()))
            {
                header_Stroke = DashStyle.Solid;
            }
            else if (HDRSTROKETYPE_DashedLine.Equals(GetHdrStrokeType()))
            {
                header_Stroke = DashStyle.Dash;
            }
            else if (HDRSTROKETYPE_DottedLine.Equals(GetHdrStrokeType()))
            {
                header_Stroke = DashStyle.Dot;
            }
            else if (HDRSTROKETYPE_Dash_DottedLine.Equals(GetHdrStrokeType()))
            {
                header_Stroke = DashStyle.DashDot;
            }

            if (string.IsNullOrEmpty(header_Stroke.ToString()))
            {
                header_Stroke = DashStyle.Solid;
            }


            return(header_Stroke);
        }
Exemple #2
0
        private void PaintForm_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 4; i++)
            {
                DrawMode ss = (DrawMode)i;
                shapeStyleCombo.Items.Add(ss);
            }
            shapeStyleCombo.SelectedIndex = 0;

            for (int i = 1; i < 11; i++)
            {
                widthCombo.Items.Add(i);
            }
            for (int i = 15; i <= 60; i += 5)
            {
                widthCombo.Items.Add(i);
            }
            widthCombo.SelectedIndex = 0;

            for (int i = 0; i < 4; i++)
            {
                DashStyle ds = (DashStyle)i;
                lineStyleCombo.Items.Add(ds.ToString());
            }
            lineStyleCombo.SelectedIndex = 0;

            imageFile = new ImageFile(new Size(500, 500), Color.White);
            ShowImage();
        }
Exemple #3
0
        public DataForm(GraphControl graph, DataItem item, MainForm mainform)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.graph = graph;
            if (item == null)
            {
                newitem   = true;
                item      = new DataItem();
                item.name = "Data" + index++;
                graph.Model.Items.Add(item);
            }
            this.item     = item;
            temp          = new DataItem();
            temp.model    = graph.Model;
            this.mainform = mainform;
            loadForm      = new LoadDataForm(this, item);
            mainform.ResetMenu();
            lineStyle.DropDownStyle = ComboBoxStyle.DropDownList;
            for (DashStyle s = DashStyle.Solid; s < DashStyle.Custom; s++)
            {
                lineStyle.Items.Add(s.ToString());
            }
            lineStyle.SelectedIndex = 0;
        }
Exemple #4
0
        public Pen Pen(Color color, DashStyle dashStyle, float dashLength, float spaceLength)
        {
            this.m_StringBuilder.Length = 0;
            this.m_StringBuilder.Append(color.GetHashCode().ToString());
            this.m_StringBuilder.Append(dashStyle.ToString());
            this.m_StringBuilder.Append("DL");
            this.m_StringBuilder.Append(dashLength.ToString());
            this.m_StringBuilder.Append("SL");
            this.m_StringBuilder.Append(spaceLength.ToString());
            string key = this.m_StringBuilder.ToString();
            Pen    pen = this.m_CachePens[key] as Pen;

            if (pen == null)
            {
                float[] dashPattern = new float[2]
                {
                    dashLength,
                    spaceLength
                };
                pen             = new Pen(color);
                pen.DashPattern = dashPattern;
                pen.DashStyle   = dashStyle;
                this.m_CachePens.Add(key, pen);
            }
            return(pen);
        }
Exemple #5
0
 public string ToString(string format, IFormatProvider formatProvider)
 {
     if (format == null)
     {
         return(String.Format("({0},{1},{2})", _dashStyle.ToString(), _width.ToString(), _color.ToString()));
     }
     return(String.Format("{0}", format));
 }
Exemple #6
0
        private void PaintForm_Load(object sender, EventArgs e)
        {
            // fill (fill style) list
            for (int i = 0; i < 3; i++)
            {
                BrushType bt = (BrushType)i;
                fillStyleCombo.Items.Add(bt);
            }
            for (int i = 0; i < 53; i++)
            {
                HatchStyle hs = (HatchStyle)i;
                fillStyleCombo.Items.Add(hs);
            }
            fillStyleCombo.SelectedIndex = 0;

            // fill shape style list
            for (int i = 0; i < 4; i++)
            {
                DrawMode ss = (DrawMode)i;
                shapeStyleCombo.Items.Add(ss);
            }
            shapeStyleCombo.SelectedIndex = 0;

            // fill Width list
            for (int i = 1; i < 11; i++)
            {
                widthCombo.Items.Add(i);
            }
            for (int i = 15; i <= 60; i += 5)
            {
                widthCombo.Items.Add(i);
            }
            widthCombo.SelectedIndex = 0;

            // fill Gradiant style list
            for (int i = 0; i < 4; i++)
            {
                LinearGradientMode gm = (LinearGradientMode)i;
                gradiantStyleCombo.Items.Add(gm);
            }
            gradiantStyleCombo.SelectedIndex = 0;

            for (int i = 0; i < 4; i++)
            {
                DashStyle ds = (DashStyle)i;
                lineStyleCombo.Items.Add(ds.ToString());
            }
            lineStyleCombo.SelectedIndex = 0;

            // default texture brush image
            brushImageBox.Image = new Bitmap(20, 20);

            // default image
            imageFile = new ImageFile(new Size(500, 500), Color.White);
            ShowImage();
        }
Exemple #7
0
        public XmlElement WriteToXml(XmlDocument doc)
        {
            XmlElement xe = doc.CreateElement("LineStyle");

            xe.SetAttribute("Color", ColorConverter.SerializeColor(_color));
            xe.SetAttribute("Width", _width.ToString());
            xe.SetAttribute("DashStyle", _dashStyle.ToString());

            return(xe);
        }
Exemple #8
0
        private void ChangeBrushesEvent(DashStyle ds)
        {
            tsbtnStatusBrushes.Text = "Brushes: " + ds.ToString();

            Bitmap tmpBrs = new Bitmap(60, 25);

            using (var g = Graphics.FromImage(tmpBrs))
            {
                Pen tmpP = new Pen(Color.Black, 4);
                tmpP.DashStyle = ds;
                g.DrawLine(tmpP, 0, 13, 60, 13);
            }
            tsbtnStatusBrushes.Image = tmpBrs;
        }
Exemple #9
0
        public Pen Pen(Color color, DashStyle dashStyle)
        {
            this.m_StringBuilder.Length = 0;
            this.m_StringBuilder.Append(color.GetHashCode().ToString());
            this.m_StringBuilder.Append(dashStyle.ToString());
            string key = this.m_StringBuilder.ToString();
            Pen    pen = this.m_CachePens[key] as Pen;

            if (pen == null)
            {
                pen           = new Pen(color);
                pen.DashStyle = dashStyle;
                this.m_CachePens.Add(key, pen);
            }
            return(pen);
        }
Exemple #10
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);
        }
Exemple #11
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();
        }
Exemple #12
0
        public SourceForm(GraphControl graph, FunctionItem old, MainForm mainform)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.graph              = graph;
            parForm                 = new ParForm();
            paritem                 = new FunctionItem();
            oldItem                 = old;
            this.mainform           = mainform;
            lineStyle.DropDownStyle = ComboBoxStyle.DropDownList;
            for (DashStyle s = DashStyle.Solid; s < DashStyle.Custom; s++)
            {
                lineStyle.Items.Add(s.ToString());
            }
            lineStyle.SelectedIndex = 0;
        }
Exemple #13
0
        private void PaintForm_Load(object sender, EventArgs e)
        {
            // fill (fill style) list
            for (int i = 0; i < 1; i++)
            {
                BrushType bt = (BrushType)i;
                fillStyleCombo.Items.Add(bt);
            }
            fillStyleCombo.SelectedIndex = 0;

            // fill shape style list
            for (int i = 0; i < 1; i++)
            {
                DrawMode ss = (DrawMode)i;
                shapeStyleCombo.Items.Add(ss);
            }
            shapeStyleCombo.SelectedIndex = 0;

            // fill Width list
            for (int i = 1; i < 11; i++)
            {
                widthCombo.Items.Add(i);
            }
            for (int i = 15; i <= 60; i += 5)
            {
                widthCombo.Items.Add(i);
            }
            widthCombo.SelectedIndex = 5;

            for (int i = 0; i < 1; i++)
            {
                DashStyle ds = (DashStyle)i;
                lineStyleCombo.Items.Add(ds.ToString());
            }
            lineStyleCombo.SelectedIndex = 0;

            // default image
            imageFile = new ImageFile(new Size(500, 500), Color.White);
            ShowImage();
        }
Exemple #14
0
        internal static string _ConvertToString(DashStyle dashStyle)
        {
            switch (dashStyle)
            {
            case DashStyle.Solid:
                return(Lang._("Solid"));

            case DashStyle.Dash:
                return(Lang._("Dash"));

            case DashStyle.Dot:
                return(Lang._("Dot"));

            case DashStyle.DashDot:
                return(Lang._("Dash Dot"));

            case DashStyle.DashDotDot:
                return(Lang._("Dash Dot Dot"));

            default:
                return(dashStyle.ToString());
            }
        }
Exemple #15
0
        private Image GetDashStyleImage(DashStyle dashStyle)
        {
            string nameFormat = "Images.DashStyleButton.{0}.png";
            string name = string.Format(nameFormat, dashStyle.ToString());
            ImageResource imageResource = PdnResources.GetImageResource(name);

            Image returnImage;

            if (UI.GetXScaleFactor() == 1.0f && UI.GetYScaleFactor() == 1.0f)
            {
                returnImage = imageResource.Reference;
            }
            else
            {
                returnImage = new Bitmap(imageResource.Reference, UI.ScaleSize(imageResource.Reference.Size));
            }

            return returnImage;
        }
 /// <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;
 }