using Resources; using SmartCoalApplication.Core; using SmartCoalApplication.Resources; using System.Drawing; using System.IO; using System.Windows.Forms; namespace SmartCoalApplication { internal class SplashForm : PdnBaseForm { private Label copyrightLabel; //private PdnBanner banner; private ProgressBar progressBar; private PictureBox pictureBox; private Image img; private Size imgSize = new Size(600, 400); public SplashForm() { //SuspendLayout(); // // Required for Windows Form Designer support // InitializeComponent(); // Fill in the status label //banner.BannerText = PdnResources.GetString("SplashForm.StatusLabel.Text"); // Fill in the copyright label copyrightLabel.Text = PdnInfo.GetCopyrightString(); } public SplashForm(string path) { GetWelcomeImge(path); if (this.img != null) { //if (this.img.Width > 0 && this.img.Height > 0) // this.imgSize = new Size(img.Width, img.Height); //else // this.imgSize = new Size(600, 400); this.imgSize = new Size(600, 400); InitializeComponent(); this.Size = new Size(600, 400); copyrightLabel.Text = PdnInfo.GetCopyrightString(); CombineLogo(); this.pictureBox.Image = this.img; } } /// /// Get Welcome Image From Local /// /// private void GetWelcomeImge(string path) { if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path)) { try { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); int byteLength = (int)fs.Length; byte[] fileBytes = new byte[byteLength]; fs.Read(fileBytes, 0, byteLength); fs.Close(); this.img = Image.FromStream(new MemoryStream(fileBytes)); } catch (System.Exception) { this.img = PdnResources.GetImageResource("Images.Banner1.jpg").GetCopy(); } finally { } } else { this.img = PdnResources.GetImageResource("Images.Banner1.jpg").GetCopy(); } } /// /// Combine Image And Logo /// private void CombineLogo() { try { Image pdnLogo = PdnResources.GetImageResource("Images.TransparentLogo.png").GetCopy(); Graphics graphics = Graphics.FromImage(this.img); graphics.DrawImage(pdnLogo, new PointF(0, 0)); graphics.Dispose(); } catch (System.Exception) { } } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.pictureBox = new System.Windows.Forms.PictureBox(); this.copyrightLabel = new System.Windows.Forms.Label(); this.progressBar = new System.Windows.Forms.ProgressBar(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // // pictureBox // this.pictureBox.Dock = System.Windows.Forms.DockStyle.Top; this.pictureBox.Location = new System.Drawing.Point(0, 0); this.pictureBox.Name = "pictureBox"; this.pictureBox.Size = new System.Drawing.Size(291, 400); this.pictureBox.TabIndex = 5; this.pictureBox.TabStop = false; // // copyrightLabel // this.copyrightLabel.BackColor = System.Drawing.Color.White; this.copyrightLabel.Dock = System.Windows.Forms.DockStyle.Top; this.copyrightLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.copyrightLabel.Location = new System.Drawing.Point(0, 400); this.copyrightLabel.Name = "copyrightLabel"; this.copyrightLabel.Size = new System.Drawing.Size(291, 28); this.copyrightLabel.TabIndex = 3; this.copyrightLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // progressBar // this.progressBar.Dock = System.Windows.Forms.DockStyle.Top; this.progressBar.Location = new System.Drawing.Point(0, 400); this.progressBar.MarqueeAnimationSpeed = 30; this.progressBar.Maximum = 0; this.progressBar.Name = "progressBar"; this.progressBar.Size = new System.Drawing.Size(291, 0); this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee; this.progressBar.TabIndex = 4; // // SplashForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); //this.ClientSize = new System.Drawing.Size(291, 270); this.ControlBox = false; this.Controls.Add(this.copyrightLabel); this.Controls.Add(this.progressBar); this.Controls.Add(this.pictureBox); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "SplashForm"; this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Controls.SetChildIndex(this.pictureBox, 0); this.Controls.SetChildIndex(this.progressBar, 0); this.Controls.SetChildIndex(this.copyrightLabel, 0); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.ResumeLayout(false); } #endregion } }