Relative.DrawInfo.drawLine C# (CSharp) Method

drawLine() public method

public drawLine ( Pen pen, Vec pos0, Vec pos1 ) : void
pen System.Drawing.Pen
pos0 Vec
pos1 Vec
return void
        public void drawLine(Pen pen, Vec pos0, Vec pos1)
        {
            mGraphics.DrawLine(pen,
                (float)(mWidth + pos0.mX),
                (float)(mHeight + pos0.mY),
                (float)(mWidth + pos1.mX),
                (float)(mHeight + pos1.mY));
        }

Usage Example

Exemplo n.º 1
0
        public override void draw(DrawInfo di, Object selected)
        {
            Pen pen = new Pen(mColor);
            if (this == selected)
                pen = new Pen(Color.Blue);

            di.drawEllipse(pen,
                mParent.getScreenFromWorld(mPos0), 10, 10);
            di.drawEllipse(pen,
                mParent.getScreenFromWorld(mPos1), 10, 10);
            di.drawLine(pen,
                mParent.getScreenFromWorld(mPos0),
                mParent.getScreenFromWorld(mPos1));
            for (int i = 0; i < mSeg - 1; i++)
            {
                double alpha = (double)(i+1) / (mSeg);
                Vec pos = mPos0.mult(alpha).plus(mPos1.mult(1 - alpha));
                di.drawEllipse(pen, mParent.getScreenFromWorld(pos), 5, 5);
            }
        }
All Usage Examples Of Relative.DrawInfo::drawLine