c# 实现 圆形的pictureBox1

 

通过鼠标移动测试圆角外部不受pictureBox1 控制

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            GraphicsPath gp = new GraphicsPath();

            gp.AddEllipse(pictureBox1.ClientRectangle);

            Region region = new Region(gp);

            pictureBox1.Region = region;

            gp.Dispose();

            region.Dispose();

        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            MessageBox.Show("123");
        }
    }
}


 

你可能感兴趣的:(c# 实现 圆形的pictureBox1)