Beispiel #1
0
 public CRSReportViewerHost()
 {
     _Zoom                   = 100;
     _Page                   = new CPageSelectorPage(this);
     this.BackColor          = Color.White;
     this.Anchor             = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);
     this._Page.CloseNotify += new PageCloseNotify(this.EH_ClosePage);
     this._ChildHandle       = IntPtr.Zero;
     this.Resize            += new EventHandler(EH_Resize);
 }
Beispiel #2
0
        public void AddPage(CPageSelectorPage aPage)
        {
            if (_Pages.IndexOf(aPage) < 0)
            {
                SelectedPage        = _Pages.Add(aPage);
                aPage.HostSelector  = this;
                aPage.CurrentWidth  = 0;
                aPage.RequiredWidth = _PageWidth;
                aPage.RequiredLeft  = _Pages.IndexOf(aPage) * _PageWidth + ((_AppIcon == null ? 0 : _AppIcon.Width + 32)) + 2;
                aPage.CurrentLeft   = _Pages.IndexOf(aPage) * _PageWidth + ((_AppIcon == null ? 0 : _AppIcon.Width + 32)) + 2;
            }

            Invalidate();
        }
Beispiel #3
0
        protected int getPageAtPoint(Point aPoint)
        {
            if (aPoint.Y < this.ClientSize.Height - _PageHeight)
            {
                return(-1);
            }

            for (int i = 0; i < _Pages.Count; i++)
            {
                CPageSelectorPage iPage = (CPageSelectorPage)(_Pages[i]);
                if (iPage.CurrentLeft <= aPoint.X && (iPage.CurrentLeft + iPage.CurrentWidth) > aPoint.X)
                {
                    return(i);
                }
            }

            return(-1);
        }
Beispiel #4
0
        protected bool ModifyFrame()
        {
            // Check if all pages are viewable in the screen:
            int ifitW = 0;

            foreach (object iObj in _Pages)
            {
                CPageSelectorPage iPage = (CPageSelectorPage)iObj;
                ifitW += iPage.CurrentWidth;
            }
            if (ifitW < this.ClientSize.Width && ((CPageSelectorPage)(_Pages[0])).RequiredLeft < 0)
            {
                int iFitOffs = 0 - ((CPageSelectorPage)(_Pages[0])).RequiredLeft;

                foreach (object iObj in _Pages)
                {
                    ((CPageSelectorPage)iObj).RequiredLeft += iFitOffs;
                }
            }

            bool lResult = false;

            foreach (object iObj in _Pages)
            {
                CPageSelectorPage iPage = (CPageSelectorPage)iObj;

                if (iPage.CurrentLeft != iPage.RequiredLeft)
                {
                    lResult           = true;
                    iPage.CurrentLeft = (iPage.RequiredLeft + iPage.CurrentLeft) / 2;
                }

                if (iPage.CurrentWidth != iPage.RequiredWidth)
                {
                    lResult            = true;
                    iPage.CurrentWidth = (iPage.RequiredWidth + iPage.CurrentWidth) / 2;
                }
            }

            return(lResult);
        }
Beispiel #5
0
        public void RemovePage(CPageSelectorPage aPage)
        {
            int lPage = _Pages.IndexOf(aPage);

            if (lPage >= 0)
            {
                if (_Selected == lPage)
                {
                    _Selected--;
                }

                for (int i = lPage; i < _Pages.Count; i++)
                {
                    ((CPageSelectorPage)(_Pages[i])).RequiredLeft -= PageWidth;
                }

                _Pages.Remove(aPage);
                aPage.HostSelector = null;
                this.SelectedPage  = 0;
            }
            Invalidate();
        }
Beispiel #6
0
 protected bool EH_ClosePage(CPageSelectorPage aPage, bool aCloseAble)
 {
     RsViewEngine.ChildApplications.TerminateApplication(_ChildProcess);
     return(true);
 }
Beispiel #7
0
 protected int getVisibleWidth(CPageSelectorPage aPage)
 {
     return aPage.CurrentLeft + aPage.CurrentWidth < (this.ClientSize.Width - _RIGHTMARGIN)
             ? aPage.CurrentWidth
             : (this.ClientSize.Width - _RIGHTMARGIN) - aPage.CurrentLeft;
 }
Beispiel #8
0
        protected void DrawPage(Graphics aGraph, CPageSelectorPage aPage)
        {
            // #0: calculate positioning and etc.
            int lTabMargin = this.ClientSize.Height - _PageHeight;
            int lLeft = aPage.CurrentLeft;
            int lPageWidth = getVisibleWidth(aPage);
            int lTextAreaWidth = lPageWidth - ((_ARCRAD / 4) + _PageHeight);
            int lVisNo = _Pages.IndexOf(aPage);
            string lPageTitle = aPage.PageTitle;
            Font lDrawFont = this.Font;

            SizeF lTextSize = aGraph.MeasureString(lPageTitle, this.Font);
            if (lTextSize.Width > lTextAreaWidth)
            {
                while (lTextSize.Width > lTextAreaWidth)
                {
                    if (lPageTitle.Length > 0)
                        lPageTitle = lPageTitle.Substring(0, lPageTitle.Length - 1);
                    lTextSize = aGraph.MeasureString(lPageTitle + "...", this.Font);
                    if (lPageTitle.Length <= 0)
                        break;
                }
                lPageTitle += "...";
            }

            if (lLeft > (this.ClientSize.Width - _RIGHTMARGIN))
                return;

            // #1: Draw the page graphics
            if (lVisNo == _Selected)
            {
                aGraph.FillPath(new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)), this.getTabFill(lLeft + 2, lTabMargin + 2, lPageWidth, _PageHeight));
                aGraph.FillPath(_brSelected, this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
            }
            else if (lVisNo == _HighLighted)
            {
                aGraph.FillPath(new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)), this.getTabFill(lLeft + 1, lTabMargin + 1, lPageWidth, _PageHeight));
                aGraph.FillPath(_brNoSelected, this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
                aGraph.FillPath(new SolidBrush(Color.FromArgb(ControlProperties.HiglightingRate, Color.White)), this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
            }
            else
            {
                aGraph.FillPath(new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)), this.getTabFill(lLeft + 1, lTabMargin + 1, lPageWidth, _PageHeight));
                aGraph.FillPath(_brNoSelected, this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
            }

            // #2: Draw text
            if (lVisNo == _Selected)
            {
                _brText.Color = Color.Black;
                lDrawFont = new Font(this.Font, FontStyle.Bold);
                LinearGradientBrush lbrLight = new LinearGradientBrush(
                            new Rectangle(0, 0, lDrawFont.Height, lDrawFont.Height),
                            Color.FromArgb(0xaa, 0x00, 0x00, 0x00),
                            Color.FromArgb(0x00, 0x00, 0x00, 0x00),
                            0, false
                        );

                aGraph.DrawString(
                            lPageTitle,
                            lDrawFont,
                            lbrLight,
                            lLeft + _ARCRAD / 2,
                            lTabMargin + (_PageHeight - lTextSize.Height) / 2
                        );

            }
            else
                _brText.Color = Color.White;

            if (lVisNo != _Selected)
                aGraph.DrawString(
                            lPageTitle,
                            lDrawFont,
                            new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)),
                            lLeft + _ARCRAD / 2 + 1,
                            lTabMargin + (_PageHeight - lTextSize.Height) / 2 + 1
                        );

            aGraph.DrawString(
                        lPageTitle,
                        lDrawFont,
                        _brText,
                        lLeft + _ARCRAD / 2,
                        lTabMargin + (_PageHeight - lTextSize.Height) / 2
                    );

            // #3: Draw Closing icon:
            if (aPage.CloseAble)
            {
                int lSide = (_PageHeight / 4) * 3;
                int lMargin = (lSide / 3) * 2;

                Point lXTopLeft = new Point(
                            lLeft + lPageWidth - _PageHeight + (_PageHeight - lSide) / 2,
                            lTabMargin + (_PageHeight - lSide) / 2
                        );

                Point lXTopRight = new Point(
                            lXTopLeft.X + lSide,
                            lXTopLeft.Y
                        );

                Point lXBottomRight = new Point(
                            lXTopLeft.X + lSide,
                            lXTopLeft.Y + lSide
                        );

                Point lXBottomLeft = new Point(
                            lXTopLeft.X,
                            lXTopLeft.Y + lSide
                        );

                if (_CloseHLighted && _HighLighted == lVisNo)
                {
                    Draw.RoundedRect(aGraph,
                                new Rectangle(lXTopLeft, new Size(lSide, lSide)),
                                16,
                                null,
                                _brClose
                            );
                }

                _ClosePen.Width = 2;
                if (lVisNo == _Selected)
                    _ClosePen.Color = Color.Black;
                else
                    _ClosePen.Color = Color.White;

                aGraph.DrawLine(
                            _ClosePen,
                            lXTopLeft.X + lMargin,
                            lXTopLeft.Y + lMargin,
                            lXBottomRight.X - lMargin,
                            lXBottomRight.Y - lMargin
                        );
                aGraph.DrawLine(
                            _ClosePen,
                            lXTopRight.X - lMargin,
                            lXTopRight.Y + lMargin,
                            lXBottomLeft.X + lMargin,
                            lXBottomLeft.Y - lMargin
                        );

            }
        }
Beispiel #9
0
 protected int getVisibleWidth(CPageSelectorPage aPage)
 {
     return(aPage.CurrentLeft + aPage.CurrentWidth < (this.ClientSize.Width - _RIGHTMARGIN)
             ? aPage.CurrentWidth
             : (this.ClientSize.Width - _RIGHTMARGIN) - aPage.CurrentLeft);
 }
Beispiel #10
0
        protected void DrawPage(Graphics aGraph, CPageSelectorPage aPage)
        {
            // #0: calculate positioning and etc.
            int    lTabMargin     = this.ClientSize.Height - _PageHeight;
            int    lLeft          = aPage.CurrentLeft;
            int    lPageWidth     = getVisibleWidth(aPage);
            int    lTextAreaWidth = lPageWidth - ((_ARCRAD / 4) + _PageHeight);
            int    lVisNo         = _Pages.IndexOf(aPage);
            string lPageTitle     = aPage.PageTitle;
            Font   lDrawFont      = this.Font;

            SizeF lTextSize = aGraph.MeasureString(lPageTitle, this.Font);

            if (lTextSize.Width > lTextAreaWidth)
            {
                while (lTextSize.Width > lTextAreaWidth)
                {
                    if (lPageTitle.Length > 0)
                    {
                        lPageTitle = lPageTitle.Substring(0, lPageTitle.Length - 1);
                    }
                    lTextSize = aGraph.MeasureString(lPageTitle + "...", this.Font);
                    if (lPageTitle.Length <= 0)
                    {
                        break;
                    }
                }
                lPageTitle += "...";
            }

            if (lLeft > (this.ClientSize.Width - _RIGHTMARGIN))
            {
                return;
            }

            // #1: Draw the page graphics
            if (lVisNo == _Selected)
            {
                aGraph.FillPath(new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)), this.getTabFill(lLeft + 2, lTabMargin + 2, lPageWidth, _PageHeight));
                aGraph.FillPath(_brSelected, this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
            }
            else if (lVisNo == _HighLighted)
            {
                aGraph.FillPath(new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)), this.getTabFill(lLeft + 1, lTabMargin + 1, lPageWidth, _PageHeight));
                aGraph.FillPath(_brNoSelected, this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
                aGraph.FillPath(new SolidBrush(Color.FromArgb(ControlProperties.HiglightingRate, Color.White)), this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
            }
            else
            {
                aGraph.FillPath(new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)), this.getTabFill(lLeft + 1, lTabMargin + 1, lPageWidth, _PageHeight));
                aGraph.FillPath(_brNoSelected, this.getTabFill(lLeft, lTabMargin, lPageWidth, _PageHeight));
            }


            // #2: Draw text
            if (lVisNo == _Selected)
            {
                _brText.Color = Color.Black;
                lDrawFont     = new Font(this.Font, FontStyle.Bold);
                LinearGradientBrush lbrLight = new LinearGradientBrush(
                    new Rectangle(0, 0, lDrawFont.Height, lDrawFont.Height),
                    Color.FromArgb(0xaa, 0x00, 0x00, 0x00),
                    Color.FromArgb(0x00, 0x00, 0x00, 0x00),
                    0, false
                    );

                aGraph.DrawString(
                    lPageTitle,
                    lDrawFont,
                    lbrLight,
                    lLeft + _ARCRAD / 2,
                    lTabMargin + (_PageHeight - lTextSize.Height) / 2
                    );
            }
            else
            {
                _brText.Color = Color.White;
            }

            if (lVisNo != _Selected)
            {
                aGraph.DrawString(
                    lPageTitle,
                    lDrawFont,
                    new SolidBrush(Graph.ColorTools.SetAlpha(128, Color.Black)),
                    lLeft + _ARCRAD / 2 + 1,
                    lTabMargin + (_PageHeight - lTextSize.Height) / 2 + 1
                    );
            }

            aGraph.DrawString(
                lPageTitle,
                lDrawFont,
                _brText,
                lLeft + _ARCRAD / 2,
                lTabMargin + (_PageHeight - lTextSize.Height) / 2
                );

            // #3: Draw Closing icon:
            if (aPage.CloseAble)
            {
                int lSide   = (_PageHeight / 4) * 3;
                int lMargin = (lSide / 3) * 2;

                Point lXTopLeft = new Point(
                    lLeft + lPageWidth - _PageHeight + (_PageHeight - lSide) / 2,
                    lTabMargin + (_PageHeight - lSide) / 2
                    );

                Point lXTopRight = new Point(
                    lXTopLeft.X + lSide,
                    lXTopLeft.Y
                    );

                Point lXBottomRight = new Point(
                    lXTopLeft.X + lSide,
                    lXTopLeft.Y + lSide
                    );

                Point lXBottomLeft = new Point(
                    lXTopLeft.X,
                    lXTopLeft.Y + lSide
                    );

                if (_CloseHLighted && _HighLighted == lVisNo)
                {
                    Draw.RoundedRect(aGraph,
                                     new Rectangle(lXTopLeft, new Size(lSide, lSide)),
                                     16,
                                     null,
                                     _brClose
                                     );
                }

                _ClosePen.Width = 2;
                if (lVisNo == _Selected)
                {
                    _ClosePen.Color = Color.Black;
                }
                else
                {
                    _ClosePen.Color = Color.White;
                }

                aGraph.DrawLine(
                    _ClosePen,
                    lXTopLeft.X + lMargin,
                    lXTopLeft.Y + lMargin,
                    lXBottomRight.X - lMargin,
                    lXBottomRight.Y - lMargin
                    );
                aGraph.DrawLine(
                    _ClosePen,
                    lXTopRight.X - lMargin,
                    lXTopRight.Y + lMargin,
                    lXBottomLeft.X + lMargin,
                    lXBottomLeft.Y - lMargin
                    );
            }
        }
Beispiel #11
0
        public void InitializeForm()
        {
            InitializeComponent();

            _ctlPageSelector.Host = _ctlPagesHost;

            _pgCollections = new CPageSelectorPage(CollectionManagement);
            _pgCollections.CloseAble = false;
            _pgCollections.PageTitle = RsViewEngine.Locale.GetTagText(RsLocalization.TAG_MANCOLLECTIONS);
            _ctlPageSelector.AddPage(_pgCollections);

            _pgSettings = new CPageSelectorPage(_ctlSettingsPanel);
            _pgSettings.CloseAble = true;
            _pgSettings.PageTitle = RsViewEngine.Locale.GetTagText(RsLocalization.TAG_SETTINGS);

            initToolStrip();

            _ctlPageSelector.SelectedPage = 0;

            Shown += EH_Shown;
            this.Closed += new EventHandler(EH_Close);
            _pgCollections.PageSelected += new PageEventNotify(EH_CollEditSelected);
            _pgSettings.PageSelected += new PageEventNotify(EH_SettingsSelected);

            RsViewEngine.Locale.AddLocalizedControl(this);
            RsViewEngine.Locale.ApplyLocalization();
        }
Beispiel #12
0
        protected void UpdateByCursorPos(Point aLocation)
        {
            _HlCtl    = THighlightedCtl.ctlPage;
            _hlBrIcon = TBorderIcon.biNone;

            // Determine if mouse cursor is over Window control button:
            if (HostForm != null)
            {
                int lLeft   = this.Width - (3 * (_BORDERICON_SIZE * 2 + 4));
                int lTop    = 0;
                int lWidth  = 2 * _BORDERICON_SIZE;
                int lHeight = _BORDERICON_SIZE;

                if (aLocation.Y >= lTop && aLocation.Y <= lTop + lHeight && lLeft <= aLocation.X)
                {
                    int lIndex = (aLocation.X - lLeft) / (lWidth + 4);
                    lIndex = ((lIndex + 1) * (lWidth + 4)) - 4 >= aLocation.X - lLeft ? lIndex : -1;

                    if (lIndex == 0)
                    {
                        _hlBrIcon = TBorderIcon.biMinimize;
                    }
                    else
                    if (lIndex == 1)
                    {
                        _hlBrIcon = TBorderIcon.biResize;
                    }
                    else
                    if (lIndex == 2)
                    {
                        _hlBrIcon = TBorderIcon.biClose;
                    }
                }
            }

            if (aLocation.Y < this.Height - _PageHeight)
            {
                _HighLighted = -1;
                return;
            }

            _HighLighted = getPageAtPoint(aLocation);



            // Determine if mouse cursor is over prev/next button
            if (aLocation.X > this.ClientSize.Width - (_ARCRAD + 8))
            {
                _HlCtl = THighlightedCtl.ctlPrev;
                if (aLocation.X > this.ClientSize.Width - (_ARCRAD / 2 + 4))
                {
                    _HlCtl = THighlightedCtl.ctlNext;
                }
            }

            // Determine if close is highlighted:
            if (_HighLighted > -1 && _HighLighted < _Pages.Count)
            {
                CPageSelectorPage lPage = (CPageSelectorPage)(_Pages[_HighLighted]);
                int lClLeft             = lPage.CurrentLeft + getVisibleWidth(lPage) - _PageHeight;

                _CloseHLighted = (aLocation.X > lClLeft) && (aLocation.X < (lPage.CurrentLeft + getVisibleWidth(lPage)));
            }
            else
            {
                _CloseHLighted = false;
            }

            Invalidate();
        }
Beispiel #13
0
        public void RemovePage(CPageSelectorPage aPage)
        {
            int lPage = _Pages.IndexOf(aPage);
            if (lPage >= 0)
            {
                if (_Selected == lPage)
                    _Selected--;

                for (int i = lPage; i < _Pages.Count; i++)
                    ((CPageSelectorPage)(_Pages[i])).RequiredLeft -= PageWidth;

                _Pages.Remove(aPage);
                aPage.HostSelector = null;
                this.SelectedPage = 0;
            }
            Invalidate();
        }
Beispiel #14
0
 protected bool EH_ClosePage(CPageSelectorPage aPage, bool aCloseAble)
 {
     RsViewEngine.ChildApplications.TerminateApplication(_ChildProcess);
     return true;
 }
Beispiel #15
0
 //        protected override CreateParams CreateParams {
 //                get {
 //                        if (!DwmApi.DwmAvailable()) {
 //                                CreateParams lCrParams = base.CreateParams;
 //                                lCrParams.ClassStyle |= 0x00020000; // adding "DropShadow" property to the form
 //                                return lCrParams;
 //                            } else {
 //                                return base.CreateParams;
 //                            }
 //                    }
 //            }
 protected void EH_SettingsSelected(CPageSelectorPage aPage)
 {
     _ctlSettingsPanel.UpdatePanel();
     _ctlToolStrip.PageSet = _setSettings;
     _ctlToolStrip.SelectedPage = _pHome;
     _CurrentView = null;
 }
Beispiel #16
0
        protected void EH_RptViewSelected(CPageSelectorPage aPage)
        {
            _CurrentView = (CRSReportViewerHost)(aPage.Page);
            _ctlToolStrip.PageSet = _setReport;
            _ctlToolStrip.SelectedPage = _pView;

            _iGroups.Enabled = false;
            _iGroups.Pushed = false;
            _iOffline.Enabled = false;
            _iOffline.Pushed = false;

            _gPages.Enabled = false;
            _gZoom.Enabled = false;
            _gRefresh.Enabled = false;
            _gPrint.Enabled = false;
            _gToFile.Enabled = false;

            _CurrentView.RequestUIState();

            //_iGroups.Pushed = ((CRSReportViewerHost)(aPage.Page)).GetGroupPanelState();
            //_iZoomWidth.Pushed = ((CRSReportViewerHost)(aPage.Page)).FittingWidth;
            //_iZoomWnd.Pushed = ((CRSReportViewerHost)(aPage.Page)).FittingWindow;
        }
Beispiel #17
0
 protected void EH_CollEditSelected(CPageSelectorPage aPage)
 {
     _ctlToolStrip.PageSet = _setCollection;
     _ctlToolStrip.SelectedPage = _pEdit;
     _CurrentView = null;
 }
Beispiel #18
0
 public CRSReportViewerHost()
 {
     _Zoom = 100;
     _Page = new CPageSelectorPage(this);
     this.BackColor = Color.White;
     this.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);
     this._Page.CloseNotify += new PageCloseNotify(this.EH_ClosePage);
     this._ChildHandle = IntPtr.Zero;
     this.Resize += new EventHandler(EH_Resize);
 }
Beispiel #19
0
        public void AddPage(CPageSelectorPage aPage)
        {
            if (_Pages.IndexOf(aPage) < 0)
            {
                SelectedPage = _Pages.Add(aPage);
                aPage.HostSelector = this;
                aPage.CurrentWidth = 0;
                aPage.RequiredWidth = _PageWidth;
                aPage.RequiredLeft = _Pages.IndexOf(aPage) * _PageWidth + ((_AppIcon == null ? 0 : _AppIcon.Width + 32)) + 2;
                aPage.CurrentLeft = _Pages.IndexOf(aPage) * _PageWidth + ((_AppIcon == null ? 0 : _AppIcon.Width + 32)) + 2;
            }

            Invalidate();
        }