Exemplo n.º 1
0
        public GridlinesSettingsViewModel(PrinterLayer printerLayer)
        {
            units = new Collection <PrintingUnit>();
            units.Add(PrintingUnit.Inch);
            units.Add(PrintingUnit.Centimeter);
            dashStyles = new Collection <LineDashStyle>();
            foreach (LineDashStyle item in Enum.GetValues(typeof(LineDashStyle)))
            {
                dashStyles.Add(item);
            }
            showGridlines = true;
            useCellSize   = true;
            GridlinesPrinterLayer gridlinesPrinterLayer = printerLayer as GridlinesPrinterLayer;

            if (gridlinesPrinterLayer == null)
            {
                selectedBrush     = new GeoSolidBrush(GeoColor.StandardColors.Gray);
                selectedDashStyle = LineDashStyle.Dot;
                rows         = 10;
                columns      = 10;
                penWidth     = 1;
                selectedUnit = PrintingUnit.Inch;
                left         = 1;
                top          = 1;
                right        = 1;
                bottom       = 1;

                cellHeight       = 1;
                cellWidth        = 1;
                selectedCellUnit = PrintingUnit.Inch;
            }
            else
            {
                selectedBrush     = gridlinesPrinterLayer.DrawingPen.Brush as GeoSolidBrush;
                selectedDashStyle = gridlinesPrinterLayer.DrawingPen.DashStyle;
                rows         = gridlinesPrinterLayer.Rows;
                columns      = gridlinesPrinterLayer.Columns;
                penWidth     = gridlinesPrinterLayer.DrawingPen.Width;
                selectedUnit = gridlinesPrinterLayer.MarginUnit;
                left         = gridlinesPrinterLayer.Left;
                top          = gridlinesPrinterLayer.Top;
                right        = gridlinesPrinterLayer.Right;
                bottom       = gridlinesPrinterLayer.Bottom;

                cellHeight       = gridlinesPrinterLayer.CellHeight;
                cellWidth        = gridlinesPrinterLayer.CellWidth;
                selectedCellUnit = gridlinesPrinterLayer.CellUnit;
                useCellSize      = gridlinesPrinterLayer.UseCellSize;
            }
        }
Exemplo n.º 2
0
        public GridlinesPrinterLayer ToGridlinesPrinterLayer()
        {
            GridlinesPrinterLayer gridlinesPrinterLayer = new GridlinesPrinterLayer();

            gridlinesPrinterLayer.Columns              = columns;
            gridlinesPrinterLayer.Rows                 = rows;
            gridlinesPrinterLayer.DrawingPen           = new GeoPen(SelectedBrush, penWidth);
            gridlinesPrinterLayer.DrawingPen.DashStyle = selectedDashStyle;
            gridlinesPrinterLayer.MarginUnit           = selectedUnit;
            gridlinesPrinterLayer.Left                 = Left;
            gridlinesPrinterLayer.Top         = Top;
            gridlinesPrinterLayer.Right       = Right;
            gridlinesPrinterLayer.Bottom      = Bottom;
            gridlinesPrinterLayer.CellHeight  = CellHeight;
            gridlinesPrinterLayer.CellWidth   = CellWidth;
            gridlinesPrinterLayer.CellUnit    = SelectedCellUnit;
            gridlinesPrinterLayer.UseCellSize = UseCellSize;

            return(gridlinesPrinterLayer);
        }