为了账号安全,请及时绑定邮箱和手机立即绑定

PictureBox与其他方法的PaintEvent

PictureBox与其他方法的PaintEvent

C#
慕少森 2019-07-25 10:38:46
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;     }
查看完整描述

2 回答

?
吃鸡游戏

TA贡献1829条经验 获得超7个赞

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}


查看完整回答
反对 回复 2019-07-25
  • 2 回答
  • 0 关注
  • 514 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信