//Constructor public PaxeraMedTestForm() { InitializeComponent(); this.filename = "./Untitled.bmp"; solidColorBrush = new SolidBrush(Color.White); pen = new Pen(solidColorBrush); pen.Width = 5; this.graphicsPictureBox = this.pictureBox1.CreateGraphics(); this.shouldPaint = false; this.shouldDrag = false; this.backgroundColor = Color.FromArgb(100, 100, 100); this.drawColor = Color.Aqua; this.posX = 0; this.posY = 0; this.deltaX = 0; this.deltaY = 0; this.zoom_factor = 1.1f; this.zoomout_factor = 0.9f; this.bitmap = new Bitmap(100, 100); this.graphicsBitmap = Graphics.FromImage(this.bitmap); this.graphicsBitmap.FillRectangle(this.solidColorBrush, 0f, 0f, this.bitmap.Width, this.bitmap.Height); this.free_hand = true; this.lines = false; this.commit_line = false; this.start_pointX = 0; this.start_pointY = 0; this.bitmapProcessor = new BitmapProcessor(); this.undoRedo = new UndoRedoFeature(); }
private void createNewToolStripMenuItem_Click(object sender, EventArgs e) { Create_Form cf = new Create_Form(); DialogResult dr = cf.ShowDialog(); if (dr == DialogResult.OK) { this.filename = cf.filename; this.bitmap = new Bitmap(cf.getWidth(), cf.getHeight()); graphicsBitmap = Graphics.FromImage(this.bitmap); graphicsBitmap.FillRectangle(this.solidColorBrush, 0f, 0f, this.bitmap.Width, this.bitmap.Height); File.Create(this.filename); this.posX = 0; this.posY = 0; this.graphicsPictureBox.Clear(this.backgroundColor); this.graphicsBitmap.DrawImage(this.bitmap, this.posX, this.posY); this.printInformation(); } this.undoRedo = new UndoRedoFeature(); this.undoRedo.AddToArray(this.bitmap); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = this.openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { this.filename = this.openFileDialog1.FileName; Image image = Image.FromFile(this.filename); bitmap = new Bitmap(image); this.graphicsBitmap = Graphics.FromImage(this.bitmap); this.graphicsPictureBox.Clear(this.backgroundColor); this.posX = 0; this.posY = 0; this.graphicsPictureBox.DrawImage(image, this.posX, this.posY); } if (result == DialogResult.Cancel) { return; } this.printInformation(); this.undoRedo = new UndoRedoFeature(); this.undoRedo.AddToArray(this.bitmap); }