Exemple #1
0
 // Methods
 internal Marker(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     markerTransForm = new Matrix();
     brush = new SolidColor(Color.Black);
     stroke = new Stroke();
 }
Exemple #2
0
 // Methods
 internal GraphPath(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.graphPath = new GraphicsPath();
     this.graphStroke = new Stroke();
     this.graphBrush = new SolidColor(Color.Empty);
     this.animpath = new GraphicsPath();
     //			this.startPoint = PointF.Empty;
     this.updateAttribute = true;
     this.graphStroke.OnStrokeBrushChanged += new EventHandler(this.ChangeStrokeBrush);
 }
Exemple #3
0
 // Methods
 internal Group(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.graphList = new SvgElementCollection();
     this.graphPath = new GraphicsPath();
     this.graphTransform = new Transf();
     this.graphBrush = new SolidColor(Color.Empty);
     this.graphStroke = new Stroke();
     this.connectPoints = new PointF[0];
     this.visible = true;
     this.showBound = false;
     this.tempOpacity = 1f;
     this.tempFillOpacity = 1f;
     this.tempStrokeOpacity = 1f;
     this.boundColor = Color.Empty;
     this.isLock = false;
     this.drawVisible = true;
     this.updateattribute = true;
     this.Changed = true;
     this.connectLines = new ItopVector.Core.SvgElementCollection();
     this.graphStroke.OnStrokeBrushChanged += new EventHandler(this.ChangeStrokeBrush);
     canSelect=true;
     this.limitSize =false;
 }
Exemple #4
0
        // Methods
        public DrawArea()
        {
            this.components = null;
            this.mouseAreaControl = null;
            this.pageSetting = new PageSettings();
            this.drawMode = DrawModeType.ScreenImage;
            this.virtualLeft = 0f;
            this.virtualTop = 0f;
            this.scale = 1f;
            this.coordTransform = new Matrix();
            this.viewSize = new SizeF(500f, 500f);
            this.showGrid = true;
            this.showRule = true;
            this.showGuides = false;
            this.lockGuides = false;
            this.gridSize = new SizeF(10f, 10f);
            this.firstload = true;
            this.operation = ToolOperation.None;

            this.centerPoint = PointF.Empty;
            this.oldpoint = Point.Empty;
            this.prepathchanged = false;
            this.preGraph = null;
            this.UpdateRule = true;
            this.RefLines = new ArrayList(0x10);
            this.SnapToGrid = false;
            this.SnapToGuides = false;
            this.PreTextSelect = new SvgElementCollection();
            this.InitializeComponent();
            this.viewer.drawArea = this;
            this.margin = Size.Round(this.viewer.margin);
            this.mouseAreaControl.Focus();
            this.mouseAreaControl.PicturePanel = this;
            this.mouseAreaControl.DragAndDrop+=new DragEventHandler(mouseAreaControl_DragDrop);
            this.FillBrush = new SolidColor(Color.White);
            this.stroke = new Stroke(new SolidColor(Color.Black));
            this.backColor = new SolidBrush(Color.White);
            this.RatTextStyle = new ItopVector.Struct.TextStyle("����", 12, false, false, false);
            base.MouseWheel += new MouseEventHandler(this.DealMouseWheel);
            addedElements=new SvgElementCollection();
            this.viewer.ViewChanged +=new ViewChangedEventHandler(viewer_ViewChanged);
            this.mouseAreaControl.BeforeDragDrop+=new DragEventHandler(DrawArea_BeforeDragDrop);
            this.mouseAreaControl.OnPolyLineBreak += new PolyLineBreakEventHandler(mouseAreaControl_OnPolyLineBreak);
            this.mouseAreaControl.OnAddElement += new AddSvgElementEventHandler(mouseAreaControl_OnAddElement);
            this.mouseAreaControl.MouseMove += new MouseEventHandler(mouseAreaControl_MouseMove);
            this.mouseAreaControl.MouseDown += new MouseEventHandler(mouseAreaControl_MouseDown);
            this.mouseAreaControl.MouseUp += new MouseEventHandler(mouseAreaControl_MouseUp);
            this.mouseAreaControl.OnElementMove += new ElementMoveEventHandler(mouseAreaControl_OnElementMove);

            //            base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true);
        }
Exemple #5
0
 public static Stroke GetStroke(IGraphPath path)
 {
     Pen pen1 = null;
     string text1 = AttributeFunc.ParseAttribute("stroke", (SvgElement) path, false).ToString();
     Color color1 = Color.Empty;
     ISvgBrush brush1 = new SolidColor(Color.Empty);
     if ((text1 != null) || (text1 != string.Empty))
     {
         brush1 = BrushManager.Parsing(text1, ((SvgElement) path).OwnerDocument);
     }
     text1 = AttributeFunc.ParseAttribute("stroke-opacity", (SvgElement) path, false).ToString();
     float single1 = 1f;
     if ((text1 != string.Empty) && (text1 != null))
     {
         single1 = Math.Max((float) 0f, Math.Min((float) 255f, ItopVector.Core.Func.Number.ParseFloatStr(text1)));
     }
     if (single1 > 1f)
     {
         single1 /= 255f;
     }
     single1 = Math.Min(path.Opacity, path.StrokeOpacity);
     float single2 = 1f;
     object obj1 = AttributeFunc.ParseAttribute("stroke-width", (SvgElement) path, false);
     if (obj1 is float)
     {
         single2 = (float) obj1;
     }
     pen1 = new Pen(Color.Empty, single2);
     pen1.Alignment = PenAlignment.Outset;
     string text2 = AttributeFunc.FindAttribute("stroke-linecap", (SvgElement) path).ToString();
     if (text2 == "round")
     {
         LineCap cap1;
         pen1.EndCap = cap1 = LineCap.Round;
         pen1.StartCap = cap1;
     }
     else if (text2 == "square")
     {
         LineCap cap2;
         pen1.EndCap = cap2 = LineCap.Square;
         pen1.StartCap = cap2;
     }
     else
     {
         LineCap cap3;
         pen1.EndCap = cap3 = LineCap.Flat;
         pen1.StartCap = cap3;
     }
     string text3 = AttributeFunc.FindAttribute("stroke-linejoin", (SvgElement) path).ToString();
     if (text3 == "round")
     {
         pen1.LineJoin = LineJoin.Round;
     }
     else if (text3 == "bevel")
     {
         pen1.LineJoin = LineJoin.Bevel;
     }
     else
     {
         pen1.LineJoin = LineJoin.Miter;
     }
     string text4 = AttributeFunc.FindAttribute("stroke-miterlimit", (SvgElement) path).ToString();
     if (text4 == "")
     {
         text4 = "4";
     }
     float single3 = ItopVector.Core.Func.Number.parseToFloat(text4, (SvgElement) path, SvgLengthDirection.Horizontal);
     if (single3 < 1f)
     {
         throw new Exception("stroke-miterlimit " + ItopVector.Core.Config.Config.GetLabelForName("notlowerstr") + " 1:" + text4);
     }
     pen1.MiterLimit = single3;
     string text5 = AttributeFunc.FindAttribute("stroke-dasharray", (SvgElement) path).ToString();
     if ((text5 != "") && (text5 != "none"))
     {
         Regex regex1 = new Regex(@"[\s\,]+");
         text5 = regex1.Replace(text5, ",");
         char[] chArray1 = new char[1] { ',' } ;
         string[] textArray1 = text5.Split(chArray1);
         float[] singleArray1 = new float[textArray1.GetLength(0)];
         for (int num1 = 0; num1 < textArray1.GetLength(0); num1++)
         {
             singleArray1[num1] = ItopVector.Core.Func.Number.ParseFloatStr(textArray1[num1]) / pen1.Width;
         }
         if ((singleArray1.GetLength(0) % 2) == 1)
         {
             float[] singleArray2 = new float[singleArray1.GetLength(0) * 2];
             singleArray1.CopyTo(singleArray2, 0);
             singleArray1.CopyTo(singleArray2, singleArray1.GetLength(0));
             singleArray1 = singleArray2;
         }
         pen1.DashPattern = singleArray1;
     }
     string text6 = AttributeFunc.FindAttribute("stroke-dashoffset", (SvgElement) path).ToString();
     float single4 = 0f;
     if (text6 != "")
     {
         single4 = ItopVector.Core.Func.Number.parseToFloat(text6, (SvgElement) path, SvgLengthDirection.Horizontal);
     }
     float single5 = Math.Abs((float) AnimFunc.GetAnimateValue((SvgElement) path, "stroke-dashoffset", DomType.SvgNumber, single4)) / pen1.Width;
     pen1.DashOffset = single5 / single2;
     if (brush1 != null)
     {
         brush1.Pen = pen1;
     }
     Stroke stroke1 = new Stroke(brush1);
     stroke1.Opacity = single1;
     return stroke1;
 }
Exemple #6
0
        private void dotNetBarManager1_PopupContainerUnload(object sender, System.EventArgs e)
        {
            ButtonItem item=sender as ButtonItem;
            if(item.Name=="mForecolor")
            {
                DevComponents.DotNetBar.PopupContainerControl container=item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr=container.Controls[0] as ColorPicker;
                if(clr.SelectedColor!=Color.Empty)
                {
                    frmDocument activedocument=this.ActiveMdiChild as frmDocument;
                    if(activedocument!=null)
                    {
                            ItopVector.Core.Paint.Stroke stroke1= new Stroke(new SolidColor(clr.SelectedColor));

                        activedocument.documentControl1.Stroke = stroke1;
                    }
                }
            }
            else if(item.Name=="mBackcolor")
            {
                DevComponents.DotNetBar.PopupContainerControl container=item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr=container.Controls[0] as ColorPicker;
                if(clr.SelectedColor!=Color.Empty)
                {
                    frmDocument activedocument=this.ActiveMdiChild as frmDocument;
                    if(activedocument!=null)
                    {
                        SolidColor fill=new SolidColor(clr.SelectedColor);
                        activedocument.documentControl1.Fill=fill;
                    }
                }
            }
            else if(item.Name == "mStar")
            {
                DevComponents.DotNetBar.PopupContainerControl container=item.PopupContainerControl as PopupContainerControl;
                StarOption star = container.Controls[0] as StarOption;
                frmDocument activedocument=this.ActiveMdiChild as frmDocument;
                if(activedocument!=null)
                {

                    activedocument.documentControl1.DrawArea.LineCount = (int)star.radialPicker.Value;
                    activedocument.documentControl1.DrawArea.Indent = (float)star.IndentPicker.Value/100f;

                }
            }
        }