Example #1
0
        //"窗体加载"事件处理方法
        private void Form1_Load(object sender, EventArgs e)
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
            this.UpdateStyles();
            Bitmap   bmp = new Bitmap(pbImg.Width, pbImg.Height);
            Graphics g   = Graphics.FromImage(bmp);

            g.FillRectangle(new SolidBrush(pbImg.BackColor), new Rectangle(0, 0, pbImg.Width, pbImg.Height));
            g.Dispose();
            dt             = new DrawTools(this.pbImg.CreateGraphics(), Color.Red, bmp);//实例化工具类
            DefaultPicSize = pbImg.Size;
        }