private void Draw(IntPtr winHandle,Point location,Size size)
        {
            Graphics g = Graphics.FromHwnd(winHandle);
            GraphicsPath gp = new GraphicsPath();
            Rectangle rec = new Rectangle(location, size);
            gp.AddRectangle(rec);
            Color[] surroundColor = new Color[] { Color.White };
            PathGradientBrush pb = new PathGradientBrush(gp);
            pb.CenterColor = Color.Green;
            pb.SurroundColors = surroundColor;
            g.FillPath(pb, gp);   
        }

        // 测试

        private void btnTest_Click(object sender, EventArgs e)
        {
            Draw(pictureBox1.Handle, new Point(10, 10),new Size( 20, 20));
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-11-23
  • 2022-02-11
  • 2022-12-23
  • 2022-02-08
  • 2021-08-31
猜你喜欢
  • 2021-07-21
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2021-08-07
相关资源
相似解决方案