Exemplo n.º 1
0
        void drawTo(Graphics g)
        {
            // Background
            // Brush brushBackground = new SolidBrush(BackColor);
            // g.FillRectangle(brushBackground, this.ClientRectangle);
            Rectangle seq      = this.ClientRectangle;
            Pen       framePen = new Pen(frameColor);

            getSequencerGeometry(ref seq);
            g.DrawRectangle(framePen, seq);
            if (_hlCol >= 0)
            {
                int       x1 = seq.X + _hlCol * seq.Width / _columns;
                int       x2 = seq.X + (_hlCol + 1) * seq.Width / _columns;
                Rectangle hl = new Rectangle(x1, seq.Y, x2 - x1 - 1, seq.Height);
                Brush     hb = new SolidBrush(_highLightColor);
                g.FillRectangle(hb, hl);
            }
            if ((dragMode == DragMode.Holding) && (dragcol >= 0) && (dragcol >= 0))
            {
                int   x1 = seq.X + dragcol * seq.Width / _columns;
                int   x2 = seq.X + (dragcol + 1) * seq.Width / _columns;
                int   y1 = seq.Y + (_rows - 1 - (dragrow + 1)) * seq.Height / _rows;
                int   y2 = seq.Y + (_rows - 1 - dragrow) * seq.Height / _rows;
                Brush hs = new SolidBrush(_selectColor);
                g.FillRectangle(hs, new Rectangle(x1, 0, x2 - x1 + 1, seq.Y - 1));
                g.FillRectangle(hs, new Rectangle(0, y2, seq.X - 1, y2 - y1 + 1));
            }

            if (_showColHeads)
            {
                Brush colheadbrush = new SolidBrush(_colHeadColor);
                for (int c = 0; c < _columns; c++)
                {
                    Vector tp = new Vector(seq.X + (double)seq.Width / _columns * (c + 0.5), seq.Y);
                    GraphicsUtil.drawText(g, tp, _colHeadFont, scale, string.Format("{0}", (c % _takt) + 1), 0, 2, 0, -1, Vector.X, colheadbrush);
                }
            }
            if (_showRowHeads)
            {
                Brush rowheadbrush = new SolidBrush(_rowHeadColor);
                for (int r = 0; r < _rows; r++)
                {
                    Vector tp = new Vector(seq.X, seq.Y + (double)seq.Height / _rows * (r + 0.5));
                    GraphicsUtil.drawText(g, tp, _rowHeadFont, scale, notename(_rows - r), 0, 2, 1, 0, Vector.X, rowheadbrush);
                }
            }
            for (int c = 1; c < _columns; c++)
            {
                int cx = seq.X + seq.Width * c / _columns;
                g.DrawLine(framePen, cx, seq.Y, cx, seq.Y + seq.Height - 1);
            }
            for (int r = 1; r < _rows; r++)
            {
                int cy = seq.Y + seq.Height * r / _rows;
                g.DrawLine(framePen, seq.X, cy, seq.X + seq.Width - 1, cy);
            }
            Brush fb = new SolidBrush(fillOnColor);

            for (int r = 0; r < _rows; r++)
            {
                for (int c = 0; c < _columns; c++)
                {
                    if (_data[r, c] > 0)
                    {
                        Vector ctr = Vector.V(seq.X + (c + 0.5) * seq.Width / _columns, seq.Y + (_rows - 1 - r + 0.5) * seq.Height / _rows);
                        // ((SolidBrush)fb).Color = fillOnColor;
                        GraphicsUtil.fillCircle(g, ctr, (double)seq.Width / _columns / 3, fb);
                    }
                }
            }
        }