123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- namespace PaintDotNet
- {
- /// <summary>
- /// »¶Ó½çÃæ
- /// </summary>
- 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);
- InitializeComponent();
- copyrightLabel.Text = PdnInfo.GetCopyrightString();
- CombineLogo();
- this.pictureBox.Image = this.img;
- }
- }
- /// <summary>
- /// Get Welcome Image From Local
- /// </summary>
- /// <param name="path"></param>
- 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();
- }
- }
-
- /// <summary>
- /// Combine Image And Logo
- /// </summary>
- 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
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- //this.banner = new PdnBanner();
- this.pictureBox = new PictureBox();
- this.copyrightLabel = new Label();
- this.progressBar = new ProgressBar();
- this.SuspendLayout();
- //
- // banner
- //
- //this.banner.Name = "banner";
- //this.banner.Location = new Point(0, 0);
- //this.banner.Dock = DockStyle.Top;
- //
- //picturebox
- //
- this.pictureBox.Name = "banner";
- this.pictureBox.Location = new Point(0, 0);
- this.pictureBox.Dock = DockStyle.Top;
- this.pictureBox.Size = imgSize;
- //
- // copyrightLabel
- //
- this.copyrightLabel.BackColor = Color.White;
- this.copyrightLabel.Dock = DockStyle.Top;
- this.copyrightLabel.Font = new Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.copyrightLabel.Name = "copyrightLabel";
- //this.copyrightLabel.Size = new Size(this.banner.ClientSize.Width, 28);
- this.copyrightLabel.Size = new Size(this.pictureBox.ClientSize.Width, 28);
- this.copyrightLabel.TabIndex = 3;
- this.copyrightLabel.TextAlign = ContentAlignment.MiddleLeft;
- //
- // progressBar
- //
- this.progressBar.Minimum = 0;
- this.progressBar.Maximum = 0;
- this.progressBar.Value = 0;
- this.progressBar.Style = ProgressBarStyle.Marquee;
- this.progressBar.MarqueeAnimationSpeed = 30;
- this.progressBar.Dock = DockStyle.Top;
- //this.progressBar.Size = new Size(this.banner.ClientSize.Width, 0);
- this.progressBar.Size = new Size(this.pictureBox.ClientSize.Width, 0);
- //
- // SplashForm
- //
- this.AutoScaleDimensions = new SizeF(96F, 96F);
- this.AutoScaleMode = AutoScaleMode.Dpi;
- //this.ClientSize = new Size(
- // this.banner.ClientSize.Width,
- // this.banner.ClientSize.Height + this.copyrightLabel.ClientSize.Height + this.progressBar.ClientSize.Height);
- this.ClientSize = new Size(
- this.pictureBox.ClientSize.Width,
- this.pictureBox.ClientSize.Height + this.copyrightLabel.ClientSize.Height + this.progressBar.ClientSize.Height);
- this.ControlBox = false;
- this.Controls.Add(this.copyrightLabel);
- this.Controls.Add(this.progressBar);
- //this.Controls.Add(this.banner);
- this.Controls.Add(this.pictureBox);
- this.FormBorderStyle = FormBorderStyle.None;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "SplashForm";
- this.ShowInTaskbar = false;
- this.SizeGripStyle = SizeGripStyle.Hide;
- this.StartPosition = FormStartPosition.CenterScreen;
- this.ResumeLayout(false);
- }
- #endregion
- }
- }
|