예제 #1
0
        public Demo_CellsGetBigger()
        {
            Func <int, double> f = (int n) => (double)(n + 40);
            var colinfo          = new Dimension_FromDelegate((int?)null, f, false);
            var rowinfo          = new Dimension_FromDelegate((int?)null, f, false);

            var bginfo_inset = new ValuePerCell_Steady <Padding?> (new Padding(1));
            var bginfo_white = new ValuePerCell_Steady <CrossGraphics.Color> (CrossGraphics.Colors.White);

            IDrawCell <IGraphics> dec = new DrawCell_Fill(bginfo_white);

            dec = new DrawCell_Chain_Padding(bginfo_inset, dec);
            //dec = new DrawEachCell_Cache (dec, colinfo, rowinfo);

            Main = new MainPanel(
                colinfo,
                rowinfo,
                new DrawVisible_Adapter_DrawCell <IGraphics>(dec)
                );
        }
예제 #2
0
        public TrivialGrid()
        {
            var colinfo = new Dimension_FromDelegate(
                () => Cells.GetLength(1),
                (int n) => ColumnWidth,
                false);

            PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == TrivialGrid.ColumnWidthProperty.PropertyName)
                {
                    colinfo.notify_changed(-1);
                }
                // TODO listen for change number
            };
            var rowinfo = new Dimension_FromDelegate(
                () => Cells.GetLength(0),
                (int n) => RowHeight,
                false);

            PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == TrivialGrid.RowHeightProperty.PropertyName)
                {
                    rowinfo.notify_changed(-1);
                }
                // TODO listen for change number
            };

            var text = new ValuePerCell_FromDelegates <string> (gv);

            var fmt = new ValuePerCell_Steady <MyTextFormat> (
                new MyTextFormat
            {
                TextFont  = this.Font.ToCrossFont(),
                TextColor = CrossGraphics.Colors.Black,
                HorizontalTextAlignment = CrossGraphics.TextAlignment.Center,
                VerticalTextAlignment   = CrossGraphics.TextAlignment.Center,
            });

            IDrawCell <IGraphics> dec = new DrawCell_Text(text, fmt);

            var padding1   = new ValuePerCell_Steady <Padding?> (new Padding(1, 1, 1, 1));
            var padding4   = new ValuePerCell_Steady <Padding?> (new Padding(4, 4, 4, 4));
            var fill_white = new ValuePerCell_Steady <CrossGraphics.Color> (CrossGraphics.Colors.White);

            dec = new DrawCell_Chain_Padding(padding4, dec);
            dec = new DrawCell_Fill(fill_white, dec);
            dec = new DrawCell_Chain_Padding(padding1, dec);
            dec = new DrawCell_Chain_Cache(dec, colinfo, rowinfo);

            Main = new MainPanel(
                colinfo,
                rowinfo,
                new DrawVisible_Adapter_DrawCell <IGraphics>(dec)
                );
            var fill_gray      = new ValuePerCell_Steady <CrossGraphics.Color> (CrossGraphics.Colors.Gray);
            var frozen_textfmt = new ValuePerCell_Steady <MyTextFormat> (
                new MyTextFormat {
                TextFont  = CrossGraphics.Font.BoldSystemFontOfSize(18),
                TextColor = CrossGraphics.Colors.Black,
                HorizontalTextAlignment = CrossGraphics.TextAlignment.Center,
                VerticalTextAlignment   = CrossGraphics.TextAlignment.Center,
            });
            var val_rownum = new ValuePerCell_RowNumber();
            var val_colnum = new ValuePerCell_ColumnLetters();

            Left = new FrozenColumnsPanel(
                new Dimension_Steady(1, 80, false),
                rowinfo,
                new DrawVisible_Adapter_DrawCell <IGraphics>(
                    new DrawCell_Chain_Padding(
                        padding1,
                        new DrawCell_Fill(
                            fill_gray,
                            new DrawCell_Text(
                                val_rownum,
                                frozen_textfmt
                                )
                            )
                        )
                    )
                );

            Top = new FrozenRowsPanel(
                colinfo,
                new Dimension_Steady(1, 40, false),
                new DrawVisible_Adapter_DrawCell <IGraphics>(
                    new DrawCell_Chain_Padding(
                        padding1,
                        new DrawCell_Fill(
                            fill_gray,
                            new DrawCell_Text(
                                val_colnum,
                                frozen_textfmt
                                )
                            )
                        )
                    )
                );
        }