Пример #1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     Bitmap pic = new Bitmap(canvas.Width, canvas.Height);
     canvas.Image = pic;
     tssbLineColor.Image = getColorBitmap(canvas.LineColor);
     tssbFillColor.Image = getColorBitmap(canvas.FillColor);
      //初始化边框
     Rectangle rect = new Rectangle();
     rect.Position = new Point(0, 0);
     rect.Width = pic.Width-1;
     rect.Height = pic.Height-1;
     rect.LineColor = Color.Black;
     rect.paint(pic);
     Fill f = new Fill();
     f.Position = new Point(1, 1);
     f.FillColor = Color.White;
     f.paint(pic);
 }
Пример #2
0
        //保持图像
        private void fill(Graphics g)
        {
            if (mouseState == 1 && mouseStateChanged)
            {
                mouseStateChanged = false;
                Fill f = new Fill();
                f.Position = startPoint;
                f.FillColor = fillColor;
                f.paint((Bitmap)this.Image);

            }
        }