Exemplo n.º 1
0
        public void AdjustSize()
        {
            RowHeightOriginal = bvgSettings.RowHeight;
            //DisplayedRowsCount =1+(int)Math.Ceiling((height - bvgSettings.HeaderHeight) / bvgSettings.RowHeight);
            DisplayedRowsCount    = (int)((height - bvgSettings.HeaderHeight) / bvgSettings.RowHeight);
            bvgSettings.RowHeight = (height - bvgSettings.HeaderHeight) / DisplayedRowsCount;


            VericalScroll = new BvgScroll
            {
                bvgGrid     = this,
                bsbSettings = new BsbSettings("VericalScroll")
                {
                    VerticalOrHorizontal = true,
                    width             = 16,
                    height            = height - bvgSettings.HeaderStyle.BorderWidth * 2,
                    ScrollVisibleSize = height - bvgSettings.HeaderHeight - bvgSettings.HeaderStyle.BorderWidth * 2,
                    ScrollTotalSize   = RowsTotalCount * RowHeightOriginal,
                    bsbStyle          = new BsbStyle
                    {
                        ButtonColor   = bvgSettings.VerticalScrollStyle.ButtonColor,
                        ThumbColor    = bvgSettings.VerticalScrollStyle.ThumbColor,
                        ThumbWayColor = bvgSettings.VerticalScrollStyle.ThumbWayColor,
                    }
                }
            };
            VericalScroll.ID = VericalScroll.bsbSettings.ID;
            VericalScroll.bsbSettings.initialize();

            HorizontalScroll = new BvgScroll
            {
                bvgGrid     = this,
                bsbSettings = new BsbSettings("HorizontalScroll")
                {
                    VerticalOrHorizontal = false,
                    width             = totalWidth,
                    height            = 16,
                    ScrollVisibleSize = 0,
                    ScrollTotalSize   = 0,
                    bsbStyle          = new BsbStyle
                    {
                        ButtonColor   = bvgSettings.HorizontalScrollStyle.ButtonColor,
                        ThumbColor    = bvgSettings.HorizontalScrollStyle.ThumbColor,
                        ThumbWayColor = bvgSettings.HorizontalScrollStyle.ThumbWayColor,
                    }
                }
            };
            HorizontalScroll.ID = HorizontalScroll.bsbSettings.ID;


            CalculateWidths();


            bvgAreaRowsFrozen.bvgGrid    = this;
            bvgAreaRowsNonFrozen.bvgGrid = this;

            bvgAreaColumnsFrozen.bvgGrid    = this;
            bvgAreaColumnsNonFrozen.bvgGrid = this;
        }
        public void InitializeScrollsAndResizer()
        {
            VerticalScroll = new BvgScroll <TItem>
            {
                bvgGrid     = this,
                bsbSettings = new BsbSettings("VericalScroll")
                {
                    VerticalOrHorizontal = true,
                    width             = bvgSettings.ScrollSize,
                    height            = bvgSize.H,
                    ScrollVisibleSize = bvgSize.H - bvgSettings.HeaderHeight,
                    ScrollTotalSize   = RowsTotalCount * bvgSettings.RowHeight,
                    bsbStyle          = new BsbStyle
                    {
                        ButtonColor   = bvgSettings.VerticalScrollStyle.ButtonColor,
                        ThumbColor    = bvgSettings.VerticalScrollStyle.ThumbColor,
                        ThumbWayColor = bvgSettings.VerticalScrollStyle.ThumbWayColor,
                    }
                }
            };
            VerticalScroll.ID = VerticalScroll.bsbSettings.ID;
            VerticalScroll.bsbSettings.initialize();



            HorizontalScroll = new BvgScroll <TItem>
            {
                bvgGrid     = this,
                bsbSettings = new BsbSettings("HorizontalScroll")
                {
                    VerticalOrHorizontal = false,
                    width             = bvgSize.W,
                    height            = bvgSettings.ScrollSize,
                    ScrollVisibleSize = 0,
                    ScrollTotalSize   = 0,
                    bsbStyle          = new BsbStyle
                    {
                        ButtonColor   = bvgSettings.HorizontalScrollStyle.ButtonColor,
                        ThumbColor    = bvgSettings.HorizontalScrollStyle.ThumbColor,
                        ThumbWayColor = bvgSettings.HorizontalScrollStyle.ThumbWayColor,
                    }
                }
            };
            HorizontalScroll.ID = HorizontalScroll.bsbSettings.ID;


            ResizerBsSettings = new BsSettings(string.Concat("SplitterResizer"))
            {
                VerticalOrHorizontal = true,
                IsDiagonal           = true,
                index   = 0,
                width   = bvgSettings.ScrollSize,
                height  = bvgSettings.ScrollSize,
                BgColor = bvgSettings.VerticalScrollStyle.ThumbColor,
            };
        }