コード例 #1
0
ファイル: MatrixView.xaml.cs プロジェクト: JeongPyoHam/Gabang
        public void Initialize(IGridProvider<string> dataProvider)
        {
            _scroller = new VisualGridScroller();

            DataProvider = dataProvider;

            _gridPoints = new GridPoints(RowCount, ColumnCount);

            RowHeader.RowCount = RowCount;
            RowHeader.ColumnCount = 1;
            RowHeader.Points = _gridPoints;
            RowHeader.DataProvider = DataProvider;

            ColumnHeader.RowCount = 1;
            ColumnHeader.ColumnCount = ColumnCount;
            ColumnHeader.Points = _gridPoints;
            ColumnHeader.DataProvider = DataProvider;

            Data.RowCount = RowCount;
            Data.ColumnCount = ColumnCount;
            Data.Points = _gridPoints;
            Data.DataProvider = DataProvider;

            _scroller.Points = _gridPoints;
            _scroller.ColumnHeader = ColumnHeader;
            _scroller.RowHeader = RowHeader;
            _scroller.DataGrid = Data;
            _scroller.DataProvider = DataProvider;
        }
コード例 #2
0
ファイル: GridLineVisual.cs プロジェクト: JeongPyoHam/Gabang
        public void Draw(
            GridRange range,
            GridPoints points)
        {
            DrawingContext drawingContext = RenderOpen();
            DoubleCollection xCollection = new DoubleCollection();
            DoubleCollection yCollection = new DoubleCollection();

            try {
                // vertical line
                double renderHeight = points.GetHeight(range.Rows);
                Rect verticalLineRect = new Rect(new Size(GridLineThickness, renderHeight));
                foreach (int i in range.Columns.GetEnumerable()) {
                    verticalLineRect.X = points.xPosition(i + 1) - GridLineThickness;
                    drawingContext.DrawRectangle(GridLineBrush, null, verticalLineRect);
                    xCollection.Add(verticalLineRect.X);
                }

                // horizontal line
                double renderWidth = points.GetWidth(range.Columns);
                Rect horizontalLineRect = new Rect(new Size(renderWidth, GridLineThickness));
                foreach (int i in range.Rows.GetEnumerable()) {
                    horizontalLineRect.Y = points.yPosition(i + 1) - GridLineThickness;
                    drawingContext.DrawRectangle(GridLineBrush, null, horizontalLineRect);
                    yCollection.Add(horizontalLineRect.Y);
                }

                XSnappingGuidelines = xCollection;
                YSnappingGuidelines = yCollection;
            } finally {
                drawingContext.Close();
            }
        }