Esempio n. 1
0
        private void PositionValuesCombo()
        {
            if (m_bvList == null)
            {
                return;
            }
            HScrollProperties hprops = m_bvList.Scroller.HorizontalScroll;
            int       iValueLocationHorizontalOffset = hprops.Value;
            Rectangle valueLocation = m_bvList.LocationOfCellInSelectedRow("Value");

            m_valuesCombo.Location = new Point(valueLocation.Left + m_listPanel.Left + 2 - iValueLocationHorizontalOffset,
                                               valueLocation.Top + m_listPanel.Top - 3);
            m_valuesCombo.Size = new Size(valueLocation.Width + 1, valueLocation.Height + 4);
            if (!Controls.Contains(m_valuesCombo))
            {
                Controls.Add(m_valuesCombo);
            }
            if (IsValuesComboBoxVisible(hprops))
            {
                m_valuesCombo.Visible = true;
                m_valuesCombo.BringToFront();
            }
            else
            {
                m_valuesCombo.Visible = false;
                m_valuesCombo.SendToBack();
            }
        }
Esempio n. 2
0
        private void ResizeImageDrawingArea()
        {
            HScrollProperties hScroll = m_imagePanel.HorizontalScroll;
            VScrollProperties vScroll = m_imagePanel.VerticalScroll;
            int  prevHMax             = hScroll.Maximum;
            int  prevVMax             = vScroll.Maximum;
            bool isHScrollVisible     = hScroll.Visible;
            bool isVScrollVisible     = vScroll.Visible;

            m_drawingArea.Width  = (int)((float)m_imageWidth * m_imageZoom);
            m_drawingArea.Height = (int)((float)m_imageHeight * m_imageZoom);

            if (isHScrollVisible)
            {
                int hNewValue = hScroll.Value + ((hScroll.Maximum - prevHMax) / 2);
                if (hNewValue < hScroll.Minimum)
                {
                    hScroll.Value = hScroll.Minimum;
                }
                else if (hNewValue > hScroll.Maximum)
                {
                    hScroll.Value = hScroll.Maximum;
                }
                else
                {
                    hScroll.Value = hNewValue;
                }
            }
            else
            {
                hScroll.Value = (hScroll.Maximum - hScroll.LargeChange) / 2;
            }

            if (isVScrollVisible)
            {
                int vNewValue = vScroll.Value + ((vScroll.Maximum - prevVMax) / 2);
                if (vNewValue < vScroll.Minimum)
                {
                    vScroll.Value = vScroll.Minimum;
                }
                else if (vNewValue > vScroll.Maximum)
                {
                    vScroll.Value = vScroll.Maximum;
                }
                else
                {
                    vScroll.Value = vNewValue;
                }
            }
            else
            {
                vScroll.Value = (vScroll.Maximum - vScroll.LargeChange) / 2;
            }

            m_drawingArea.Refresh();
        }
Esempio n. 3
0
 private void scrollMainForm(int nLines, bool horz)
 {
     if (horz)
     {
         // scroll the ChartImage left/right
         HScrollProperties hscroll = mChartImagePanel.HorizontalScroll;
         int scrollRange           = hscroll.Maximum - hscroll.Minimum;
         int scrollX = hscroll.Value + (int)(scrollRange * nLines / 100);
         scrollChartImagePanel(scrollX, null);
     }
     else
     {
         // scroll the ChartImage up/down
         VScrollProperties vscroll = mChartImagePanel.VerticalScroll;
         int scrollRange           = vscroll.Maximum - vscroll.Minimum;
         int scrollY = vscroll.Value + (int)(scrollRange * nLines / 100);
         scrollChartImagePanel(null, scrollY);
     }
 }
Esempio n. 4
0
        private bool IsValuesComboBoxVisible(HScrollProperties hprops)
        {
            int iVerticalScrollBarWidth    = (m_bvList.ScrollBar.Visible) ? SystemInformation.VerticalScrollBarWidth : 0;
            int iHorizontalScrollBarHeight = (hprops.Visible) ? SystemInformation.HorizontalScrollBarHeight : 0;

            if (m_valuesCombo.Top < (m_listPanel.Top + m_bvList.BrowseView.Top))
            {
                return(false);                 // too high
            }
            if (m_valuesCombo.Bottom > (m_listPanel.Bottom - iHorizontalScrollBarHeight))
            {
                return(false);                // too low
            }
            if (m_valuesCombo.Right > (m_listPanel.Right - iVerticalScrollBarWidth + 1))
            {
                return(false);                // too far to the right
            }
            if (m_valuesCombo.Left < m_listPanel.Left)
            {
                return(false);                // too far to the left
            }
            return(true);
        }
Esempio n. 5
0
 /// <summary>
 /// ctor
 /// </summary>
 public ScrollableView()
 {
     _hscroll = new HScrollProperties(this);
     _vscroll = new VScrollProperties(this);
 }
Esempio n. 6
0
 public HScrollPropertiesWrapper(HScrollProperties horizontalScroll)
 {
     _horizontalScroll = horizontalScroll;
 }
Esempio n. 7
0
    private void doMainFormResize(Point?clientMousePos)
    {
        // check if we are showing a ChartImage
        Image img = mChartImagePictureBox.Image;

        if (img == null)
        {
            mChartImagePanel.Visible = false;
            return;
        }
        mChartImagePanel.Visible = true;

        // resize the ChartImage panel to fill the available space
        mChartImagePanel.Size = new Size(
            mSplitter.Panel2.Width - (Program.isMono?8:17),
            mSplitter.Panel2.Height - (Program.isMono?28:40)
            );

        // figure out how large to show the ChartImage
        int    width, height;
        int    margin         = 5;
        int    availableWidth = mChartImagePanel.Width - 2 * margin;
        double zoom           = Math.Max(Math.Min(mCurrZoom, mMaxZoom), mMinZoom);

        width  = (int)(img.Width * zoom + 0.5);
        height = (int)(img.Height * zoom + 0.5);

        // check if the v-scrollbar is showing
        if (height >= mChartImagePanel.Height)
        {
            // yup - adjust the width
            int sbWidth = SystemInformation.VerticalScrollBarWidth;
            availableWidth -= sbWidth;
            width          -= sbWidth;
        }

        // remember the current scroll positions
        HScrollProperties hscroll           = mChartImagePanel.HorizontalScroll;
        int               prevScrollPosX    = hscroll.Value;
        int               prevMaxScrollX    = ChartImagePanel_MaxScrollX();
        double            prevRelScrollPosX = (double)prevScrollPosX / (double)prevMaxScrollX;
        VScrollProperties vscroll           = mChartImagePanel.VerticalScroll;
        int               prevScrollPosY    = vscroll.Value;
        int               prevMaxScrollY    = ChartImagePanel_MaxScrollY();
        double            prevRelScrollPosY = (double)prevScrollPosY / (double)prevMaxScrollY;

        // resize and position the ChartImage
        setChartImagePanelScrollPos(0, 0);
        Size prevChartImagePictureBoxSize = new Size(mChartImagePictureBox.Size.Width, mChartImagePictureBox.Size.Height);

        mChartImagePictureBox.Size = new Size(width, height);
        if (width < availableWidth)
        {
            mChartImagePictureBox.Location = new Point(margin + (availableWidth - width) / 2, margin);
        }
        else
        {
            mChartImagePictureBox.Location = new Point(margin, margin);
        }

        // restore the scroll positions
        int newScrollPosX, newScrollPosY;
        int newMaxScrollX = ChartImagePanel_MaxScrollX();
        int newMaxScrollY = ChartImagePanel_MaxScrollY();

        if (clientMousePos == null)
        {
            // maintain the relative scroll positions
            newScrollPosX = (int)(prevRelScrollPosX * newMaxScrollX + 0.5);
            newScrollPosY = (int)(prevRelScrollPosY * newMaxScrollY + 0.5);
        }
        else
        {
            // keep whatever's under the mouse in the same place
            int    absX    = prevScrollPosX + clientMousePos.Value.X;
            double scaling = (double)mChartImagePictureBox.Size.Width / (double)prevChartImagePictureBoxSize.Width;
            newScrollPosX = (int)(absX * scaling + 0.5) - clientMousePos.Value.X;
            int absY = prevScrollPosY + clientMousePos.Value.Y;
            scaling       = (double)mChartImagePictureBox.Size.Height / (double)prevChartImagePictureBoxSize.Height;
            newScrollPosY = (int)(absY * scaling + 0.5) - clientMousePos.Value.Y;
        }
        scrollChartImagePanel(newScrollPosX, newScrollPosY);
    }