public frmFrmGallery() { InitializeComponent(); splashScreen = new frmSplash(); isFirstPaint = true; PageSize = 25; CurrentPage = 1; }
private void backgroundLoad_DoWork(object sender, DoWorkEventArgs e) { if (IsHandleCreated) { this.Invoke((MethodInvoker)delegate { flowFrms.Controls.Clear(); flowFrms.Visible = false; splashScreen = new frmSplash(); }); } else { flowFrms.Controls.Clear(); flowFrms.Visible = false; splashScreen = new frmSplash(); } int count = Data.Graphics.Count; int i = 0; foreach (KeyValuePair<string, Bitmap> kvp in Data.Graphics) { i++; float progress = (float)i / (float)count; backgroundLoad.ReportProgress((int)(progress*100)); PictureBox pct = new PictureBox(); pct.Image = kvp.Value; pct.Tag = kvp.Key; pct.SizeMode = PictureBoxSizeMode.AutoSize; pct.MouseClick +=new MouseEventHandler(pct_MouseClick); pct.MouseDoubleClick += new MouseEventHandler(pct_MouseDoubleClick); Label lbl = new Label(); lbl.Text = System.IO.Path.GetFileName(kvp.Key); lbl.Font = new System.Drawing.Font(FontFamily.GenericSansSerif, 7.0f, FontStyle.Bold); lbl.AutoSize = true; FlowLayoutPanel flp = new FlowLayoutPanel(); flp.FlowDirection = FlowDirection.TopDown; flp.Controls.Add(pct); flp.Controls.Add(lbl); all.Add(flp); if (i > PageSize) flp.Visible = false; flp.MouseClick += new MouseEventHandler(flp_MouseClick); if (IsHandleCreated) { this.Invoke((MethodInvoker)delegate { flowFrms.Controls.Add(flp); splashScreen.setText(kvp.Key); }); } else { flowFrms.Controls.Add(flp); } } }
private void backgroundLoad_DoWork(object sender, DoWorkEventArgs e) { if (IsHandleCreated) { this.Invoke((MethodInvoker) delegate { flowFrms.Controls.Clear(); flowFrms.Visible = false; splashScreen = new frmSplash(); }); } else { flowFrms.Controls.Clear(); flowFrms.Visible = false; splashScreen = new frmSplash(); } int count = Data.Graphics.Count; int i = 0; foreach (KeyValuePair <string, Bitmap> kvp in Data.Graphics) { i++; float progress = (float)i / (float)count; backgroundLoad.ReportProgress((int)(progress * 100)); PictureBox pct = new PictureBox(); pct.Image = kvp.Value; pct.Tag = kvp.Key; pct.SizeMode = PictureBoxSizeMode.AutoSize; pct.MouseClick += new MouseEventHandler(pct_MouseClick); pct.MouseDoubleClick += new MouseEventHandler(pct_MouseDoubleClick); Label lbl = new Label(); lbl.Text = System.IO.Path.GetFileName(kvp.Key); lbl.Font = new System.Drawing.Font(FontFamily.GenericSansSerif, 7.0f, FontStyle.Bold); lbl.AutoSize = true; FlowLayoutPanel flp = new FlowLayoutPanel(); flp.FlowDirection = FlowDirection.TopDown; flp.Controls.Add(pct); flp.Controls.Add(lbl); all.Add(flp); if (i > PageSize) { flp.Visible = false; } flp.MouseClick += new MouseEventHandler(flp_MouseClick); if (IsHandleCreated) { this.Invoke((MethodInvoker) delegate { flowFrms.Controls.Add(flp); splashScreen.setText(kvp.Key); }); } else { flowFrms.Controls.Add(flp); } } }