コード例 #1
0
ファイル: DGFReader.cs プロジェクト: ondrej11/o106
        void SetLabelStyle(IniFile.Section section, IFigure figure)
        {
            figure.Visible = !section.ReadBool("Hide", false) && section.ReadBool("Visible", true);

            var fontName = section["FontName"];
            double? fontSize = section.TryReadDouble("FontSize");
            bool fontUnderline = section.ReadBool("FontUnderline", false);
            var foreColor = section.ReadColor("ForeColor");
            var backColor = section.ReadColor("BackColor");

            TextStyle style = new TextStyle()
            {
                FontFamily = new FontFamily(fontName),
                Color = foreColor,
                Underline = fontUnderline
            };
            if (fontSize.HasValue)
            {
                style.FontSize = fontSize.Value * 1.7;
            }

            figure.Style = drawing.StyleManager.FindExistingOrAddNew(style);
        }
コード例 #2
0
        public virtual void AddDefaultStyles()
        {
            var freePointStyle = new PointStyle()
            {
                Fill = new SolidColorBrush(Color.FromArgb(255, 255, 255, 100))
            };
            var pointOnFigureStyle = new PointStyle()
            {
                Fill = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0))
            };
            var dependentPointStyle = new PointStyle()
            {
                Name = "DependentPointStyle",
                Fill = new SolidColorBrush(Color.FromArgb(200, 192, 192, 192))
            };
            var lineStyle  = new LineStyle();
            var lineStyle2 = new LineStyle()
            {
                Name  = "OtherLine",
                Color = Color.FromArgb(200, 0, 0, 255)
            };
            var shapeWithLineStyle = new ShapeStyle();
            var shapeStyle         = new ShapeStyle()
            {
                Color = Colors.Transparent
            };
            var shapeStyle2 = new ShapeStyle()
            {
                Name  = "OtherShape",
                Color = Colors.Transparent,
                Fill  = new SolidColorBrush(Color.FromArgb(100, 200, 255, 200))
            };
            var hyperLinkStyle = new TextStyle()
            {
                FontSize   = 18,
                FontFamily = new FontFamily("Segoe UI")
            };
            var textStyle = new TextStyle()
            {
                FontSize   = 18,
                FontFamily = new FontFamily("Segoe UI")
            };
            var headerStyle = new TextStyle()
            {
                FontSize   = 40,
                FontFamily = new FontFamily("Segoe UI")
            };

            var newStyles = new IFigureStyle[]
            {
                freePointStyle,
                pointOnFigureStyle,
                dependentPointStyle,
                lineStyle,
                lineStyle2,
                shapeStyle,
                shapeStyle2,
                shapeWithLineStyle,
                textStyle,
                headerStyle,
                hyperLinkStyle,
            };

            list.AddRange(newStyles);

            numDefaultStyles = newStyles.Length;
        }
コード例 #3
0
ファイル: CartesianGrid.cs プロジェクト: ondrej11/o106
        public CartesianGrid()
        {
            //ShapeStyle arrowStyle = new ShapeStyle()
            //{
            //    Color = Color.FromArgb(255, 128, 128, 255),
            //    Fill = new SolidColorBrush(Color.FromArgb(255, 128, 128, 255)),
            //    StrokeWidth = 1,
            //    Name = "ArrowStyle"
            //};
            LineStyle axisStyle = new LineStyle()
            {
                Color = Color.FromArgb(255, 128, 128, 255),
                Name = "AxisStyle",
                StrokeWidth = 1
            };
            LineStyle gridStyle = new LineStyle()
            {
                Color = Colors.LightGray,
                Name = "GridStyle",
                StrokeWidth = 0.5
            };
            TextStyle labelsStyle = new TextStyle()
            {
                Color = Color.FromArgb(255, 128, 128, 255),
                FontSize = 12.0,
                Name = "LabelsStyle"
            };

            OriginPoint = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 0);
            XUnitPoint = Factory.CreatePointByCoordinates(Drawing, () => 1, () => 0);
            YUnitPoint = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 1);
            OriginPoint.Name = "Origin";
            XUnitPoint.Name = "XUnitPoint";
            YUnitPoint.Name = "YUnitPoint";
            OriginPoint.Visible = false;
            XUnitPoint.Visible = false;
            YUnitPoint.Visible = false;

            XAxisLine = Factory.CreateAxis(Drawing, new[] { OriginPoint, XUnitPoint });
            YAxisLine = Factory.CreateAxis(Drawing, new[] { OriginPoint, YUnitPoint });
            XAxisLine.Name = "XAxisLine";
            YAxisLine.Name = "YAxisLine";
            AxisLabels = new AxisLabelsCollection() { Drawing = Drawing };
            GridLines = new RectangularGridLinesCollection() { Drawing = Drawing };

            //XAxisLine.Arrow.Style = arrowStyle;
            XAxisLine.Line.Style = axisStyle;
            //YAxisLine.Arrow.Style = arrowStyle;
            YAxisLine.Line.Style = axisStyle;
            GridLines.Style = gridStyle;
            AxisLabels.Style = labelsStyle;

            Children.Add(
                OriginPoint,
                XUnitPoint,
                YUnitPoint,
                XAxisLine,
                YAxisLine,
                AxisLabels,
                GridLines
                );
        }
コード例 #4
0
ファイル: CartesianGrid.cs プロジェクト: radtek/Shopdrawing
        public CartesianGrid()
        {
            //ShapeStyle arrowStyle = new ShapeStyle()
            //{
            //    Color = Color.FromArgb(255, 128, 128, 255),
            //    Fill = new SolidColorBrush(Color.FromArgb(255, 128, 128, 255)),
            //    StrokeWidth = 1,
            //    Name = "ArrowStyle"
            //};
            LineStyle axisStyle = new LineStyle()
            {
                Color           = Color.FromArgb(255, 128, 128, 255),
                Name            = "AxisStyle",
                StrokeWidth     = 0.5,
                StrokeDashArray = null
            };

            // Hiển thị màu cho lưới ở các vị trí điểm nổi bật
            System.Windows.Media.Color normalGridLine    = System.Windows.Media.Colors.DarkGray;
            System.Windows.Media.Color highLightGridLine = System.Windows.Media.Colors.WhiteSmoke;
            //??

            LineStyle gridStyle = new LineStyle()
            {
                Color           = Colors.WhiteSmoke,
                Name            = "GridStyle",
                StrokeWidth     = 0.1,
                StrokeDashArray = null
            };
            TextStyle labelsStyle = new TextStyle()
            {
                Color = Color.FromArgb(255, 128, 128, 255),
                //Color = Color.FromArgb(255, 201, 201, 201),
                FontSize = 12.0,
                Name     = "LabelsStyle"
            };

            OriginPoint         = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 0);
            XUnitPoint          = Factory.CreatePointByCoordinates(Drawing, () => 1, () => 0);
            YUnitPoint          = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 1);
            OriginPoint.Name    = "Origin";
            XUnitPoint.Name     = "XUnitPoint";
            YUnitPoint.Name     = "YUnitPoint";
            OriginPoint.Visible = false;
            XUnitPoint.Visible  = false;
            YUnitPoint.Visible  = false;

            XAxisLine      = Factory.CreateAxis(Drawing, new[] { OriginPoint, XUnitPoint });
            YAxisLine      = Factory.CreateAxis(Drawing, new[] { OriginPoint, YUnitPoint });
            XAxisLine.Name = "XAxisLine";
            YAxisLine.Name = "YAxisLine";
            AxisLabels     = new AxisLabelsCollection()
            {
                Drawing = Drawing
            };
            GridLines = new RectangularGridLinesCollection()
            {
                Drawing = Drawing
            };

            //XAxisLine.Arrow.Style = arrowStyle;
            XAxisLine.Line.Style = axisStyle;
            //YAxisLine.Arrow.Style = arrowStyle;
            YAxisLine.Line.Style = axisStyle;
            GridLines.Style      = gridStyle;
            AxisLabels.Style     = labelsStyle;

            Children.Add(
                OriginPoint,
                XUnitPoint,
                YUnitPoint,
                XAxisLine,
                YAxisLine,
                AxisLabels,
                GridLines
                );
        }