Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;  //这里用来设置如何处理图片

            imageHandlers = new ImageEventHandlers();

            imageManager = imageHandlers.ImageManager; //将handler中的manager赋值给form中的manager
            imageHandlers.PictureBox1 = pictureBox1;   //将form中的picturebox赋值给handler中picturebox,不然为空
            imageHandlers.TimeLabel   = label1;
            imageHandlers.TimeLabel.DataBindings.Add("Text", imageHandlers, "TimeElapsed");
            //imageHandlers.TimeLabel.Text = "";

            //各种事件
            pictureBox1.AllowDrop = true;
            //pictureBox2.AllowDrop = true;
            //图片事件
            pictureBox1.MouseWheel += imageHandlers.pic1_MouseWheel;
            pictureBox1.MouseMove  += imageHandlers.pictureBox1_MouseMove;
            pictureBox1.MouseDown  += imageHandlers.pictureBox1_MouseDown;
            pictureBox1.MouseUp    += imageHandlers.pictureBox1_MouseUp;
            pictureBox1.DragEnter  += imageHandlers.pictureBox1_DragEnterLoad;
            pictureBox1.DragDrop   += imageHandlers.pictureBox1_DragDropLoad;
            //MouseWheel += new MouseEventHandler();
            //按钮事件
            button1.Click += imageHandlers.loadImage_Click;
            button2.Click += imageHandlers.saveImage_Click;
            button5.Click += imageHandlers.waterPic_Click;
            button6.Click += imageHandlers.cropPic_Click;
            button7.Click += imageHandlers.insertPic_Click;
            button8.Click += imageHandlers.drawOut_Click;
        }
Beispiel #2
0
 public ImageEventHandlers()
 {
     ImageManager = new ImageEffectManager();
     //初始化
     IsDrawOut = false;
 }