using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.IO; namespace AnywhereTS { public partial class frmClientBootPicture : Form { public ATSImage currentImage = null; // The current client configuration. Will be set by caller. public frmClientBootPicture() { InitializeComponent(); } private void btnLoad_Click(object sender, EventArgs e) { bool exitDialog = false; do { try { OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.jpg; *.jpeg;)|*.jpg; *.jpeg;"; if (open.ShowDialog() == DialogResult.OK) { // Open picture file currentImage.DesigntimeConfig.BootPicture.CustomPicture = new Bitmap(open.FileName); // Display boot picture on form. picBoot.Image = currentImage.DesigntimeConfig.BootPicture.CustomPicture; } exitDialog = true; } catch (Exception) { MessageBox.Show("Could not open file. Unknown format.", "AnywhereTS"); } } while (!exitDialog); } private void frmClientBootPicture_Load(object sender, EventArgs e) { helpProvider.HelpNamespace = ATSGlobals.strHelpFilePath; // Initiate helpProvider // Display boot picture resolution switch (currentImage.DesigntimeConfig.BootPicture.Width) { case 640: radBootPicRes640.Checked = true; // 640x480 break; case 800: radBootPicRes800.Checked = true; // 800x600 break; case 1024: radBootPicRes1024.Checked = true; // 1024x768 break; case 1280: radBootPicRes1280.Checked = true; // 1280x1024 break; default: MessageBox.Show("ERROR unknown boot picture resolution (49488)", "AnywhereTS"); radBootPicRes1024.Checked = true; // Default to 1024x768 break; } // Display boot picture picBoot.Image = currentImage.DesigntimeConfig.BootPicture.CustomPicture; } private void btnOk_Click(object sender, EventArgs e) { // Parse boot picture resolution if (radBootPicRes640.Checked) { currentImage.DesigntimeConfig.BootPicture.Width = 640; currentImage.DesigntimeConfig.BootPicture.Height = 480; } else if (radBootPicRes800.Checked) { currentImage.DesigntimeConfig.BootPicture.Width = 800; currentImage.DesigntimeConfig.BootPicture.Height = 600; } else if (radBootPicRes1024.Checked) { currentImage.DesigntimeConfig.BootPicture.Width = 1024; currentImage.DesigntimeConfig.BootPicture.Height = 768; } else if (radBootPicRes1280.Checked) { currentImage.DesigntimeConfig.BootPicture.Width = 1280; currentImage.DesigntimeConfig.BootPicture.Height = 1024; } // Check size if (currentImage.DesigntimeConfig.BootPicture.CustomPicture.Width != currentImage.DesigntimeConfig.BootPicture.Width || currentImage.DesigntimeConfig.BootPicture.CustomPicture.Height != currentImage.DesigntimeConfig.BootPicture.Height) { MessageBox.Show( "The source image is not of the selected size. Image will be resized(" + currentImage.DesigntimeConfig.BootPicture.CustomPicture.Width.ToString() + "x" + currentImage.DesigntimeConfig.BootPicture.CustomPicture.Height.ToString() + " > " + currentImage.DesigntimeConfig.BootPicture.Width.ToString() + "x" + currentImage.DesigntimeConfig.BootPicture.Height.ToString() + ").", "AnywhereTS"); currentImage.DesigntimeConfig.BootPicture.ImageResize(); } currentImage.DesigntimeConfig.BootPicture.Type = 1; // Custom boot picture. DialogResult = DialogResult.OK; } } }