コード例 #1
0
ファイル: Legend.cs プロジェクト: CP-H/CPHControl
        /// <summary>
        /// Draws the whole legend
        /// </summary>
        /// <param name="pane">The pane.</param>
        public void Draw(GraphPane pane)
        {
            int column = 0, row = 0;

            if (_legendEntries.Count != 0)
            {
                if (_legendEntries[0].PosSet == false)
                {
                    foreach (LegendEntry Item in _legendEntries)
                    {//calculate each entries position
                        Item.XPos   = -1 + 2 * (_innerRect.X + column * (_entrySpaceX + _entryGapX)) / pane.Rect.Width;
                        Item.YPos   = -1 + 2 * (_innerRect.Y + _innerRect.Height - (float)(row * _lineHeight)) / pane.Rect.Height;
                        Item.PosSet = true;
                        //generate the vertices for the colored lines
                        Item.line = new float[4] {
                            Item.XPos, Item.YPos - (float)_lineHeight / (2 * pane.Rect.Height),
                            Item.XPos + _colorLineLen / pane.Rect.Width, Item.YPos - (float)_lineHeight / (2 * pane.Rect.Height)
                        };
                        //step through rows and columns of the legend
                        column++;
                        if (column >= _nEntriesVert)
                        {
                            column = 0;
                            row++;
                        }
                    }
                }
            }

            _border.Draw(_rect);//draw the border, then the text, then the lines.
            _textInstance.DrawLegendText(_legendEntries, 2 * (float)_colorLineLen / pane.Rect.Width, 2 * _textLen / pane.Rect.Width, pane);
            DrawLegendLines(pane);
        }
コード例 #2
0
ファイル: PaneBase.cs プロジェクト: CP-H/CPHControl
        /// <summary>
        /// Draws the pane frame.
        /// </summary>
        public void DrawPaneFrame()
        {
            GLRectangleF rect = new GLRectangleF(_rect.X, _rect.Y, _rect.Width - 1, _rect.Height - 1);

            _glBorder.Draw(rect);
        }