Example #1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                NewFileForm newFileDialog = new NewFileForm();

                //Center the new file diagle
                newFileDialog.StartPosition = FormStartPosition.CenterParent;

                // Show new file diaglog as a modal dialog and determine if DialogResult = OK
                if (newFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    //Create new bitmap image base on user's input
                    Bitmap image = Program.CreateNewImage(newFileDialog.ImageType, newFileDialog.Width, newFileDialog.Heigh, newFileDialog.ImageName);

                    //Get image to dipslay
                    pictureBox1.Image = Program.ResizeBitmap(image, 976, 87);

                    //Display Preview Image
                    Bitmap previewImage = Program.GetWheelPreviewImage(image, pictureBox2.Width, pictureBox2.Height);
                    pictureBox2.Image = previewImage;

                    //Add log to history list
                    AddLog("Create new file: " + newFileDialog.ImageName);
                    string FileName   = newFileDialog.ImageName;
                    string FileType   = "";
                    string FileWidth  = Program.CurrentImage.Width.ToString();
                    string FileHeight = Program.CurrentImage.Width.ToString();

                    AddFileInfor(FileName, FileType, FileWidth, FileHeight);

                    //Enable Save Menu
                    saveToolStripMenuItem.Enabled = true;

                    //Enable Draw Tools
                    toolStrip1.Enabled = true;

                    //For black-white image, disable color picker button and set brush color to black
                    if (Program.CurrentImageType == 1)
                    {
                        toolStripColorPickerButton.Enabled = false;
                        m_BrushColor = Color.Black;
                    }
                    else
                    {
                        toolStripColorPickerButton.Enabled = true;
                    }
                }
                newFileDialog.Dispose();
            }
            catch (Exception exeption)
            {
                MessageBox.Show(exeption.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                AddLog("Error: " + exeption.Message);
            }
        }
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                NewFileForm newFileDialog = new NewFileForm();

                //Center the new file diagle
                newFileDialog.StartPosition = FormStartPosition.CenterParent;

                // Show new file diaglog as a modal dialog and determine if DialogResult = OK
                if (newFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    //Create new bitmap image base on user's input
                    Bitmap image = Program.CreateNewImage(newFileDialog.ImageType, newFileDialog.Width, newFileDialog.Heigh, newFileDialog.ImageName);

                    //Get image to dipslay
                    pictureBox1.Image = Program.ResizeBitmap(image, 976, 87);

                    //Display Preview Image
                    Bitmap previewImage = Program.GetWheelPreviewImage(image, pictureBox2.Width, pictureBox2.Height);
                    pictureBox2.Image = previewImage;

                    //Add log to history list
                    AddLog("Create new file: " + newFileDialog.ImageName);
                    string FileName = newFileDialog.ImageName;
                    string FileType = "";
                    string FileWidth = Program.CurrentImage.Width.ToString();
                    string FileHeight = Program.CurrentImage.Width.ToString();

                    AddFileInfor(FileName, FileType, FileWidth, FileHeight);

                    //Enable Save Menu
                    saveToolStripMenuItem.Enabled = true;

                    //Enable Draw Tools
                    toolStrip1.Enabled = true;

                    //For black-white image, disable color picker button and set brush color to black
                    if (Program.CurrentImageType == 1)
                    {
                        toolStripColorPickerButton.Enabled = false;
                        m_BrushColor = Color.Black;
                    }
                    else
                        toolStripColorPickerButton.Enabled = true;

                }
                newFileDialog.Dispose();
            }
            catch (Exception exeption)
            {
                MessageBox.Show(exeption.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                AddLog("Error: " + exeption.Message);
            }
        }