PictureBox与其他方法的PaintEvent

PictureBox与其他方法的PaintEvent

在我的表单中只有一个图片框,我想用这个图片框上的方法绘制圆圈,但我不能这样做而不工作。方法是:

private Bitmap Circle()
    {
        Bitmap bmp;
        Graphics gfx;
        SolidBrush firca_dis=new SolidBrush(Color.FromArgb(192,0,192));

            bmp = new Bitmap(40, 40);
            gfx = Graphics.FromImage(bmp);
            gfx.FillRectangle(firca_dis, 0, 0, 40, 40);

        return bmp;
    }

图片框

 private void pictureBox2_Paint(object sender, PaintEventArgs e)
    {
        Graphics gfx= Graphics.FromImage(Circle());
        gfx=e.Graphics;
    }


慕少森
浏览 520回答 2
2回答

吃鸡游戏

private static void DrawCircle(Graphics gfx){         SolidBrush firca_dis = new SolidBrush(Color.FromArgb(192, 0, 192));     Rectangle rec = new Rectangle(0, 0, 40, 40); //Size and location of the Circle     gfx.FillEllipse(firca_dis, rec); //Draw a Circle and fill it     gfx.DrawEllipse(new Pen(firca_dis), rec); //draw a the border of the cicle your choice}
打开App,查看更多内容
随时随地看视频慕课网APP