private void initSetting(String name, String text, String optionName, String settingValue) { FancyLabel option = new FancyLabel(); option.Name = optionName; option.Text = text; option.AutoSize = true; option.Location = new Point(250 + settings, Controls.Find("console", true)[0].Location.Y); option.BackColor = Color.Transparent; option.ForeColor = Color.White; option.Visible = true; backgroundBack.Controls.Add(option); option.BringToFront(); option.Font = new Font("Lithos Pro Regular", 11); defaultFancyLabels.Add(option.Name, option.Text); if (settingValue.Equals("MultiSelect")) { if (globalSettings["MultiSelect"].Equals("Yes")) { option.BackColor = Color.Purple; } } if (settingValue.Equals("ShittyComputerMode")) { if (globalSettings["ShittyComputerMode"].Equals("Yes")) { option.BackColor = Color.Purple; } } Control cont = (Control)option; cont.KeyPress += new KeyPressEventHandler(onKeyPress); cont.MouseDown += new MouseEventHandler(onMouseDown); cont.LostFocus += new EventHandler(onLabelLoseFocus); cont.MouseEnter += new EventHandler(focusGained); cont.MouseLeave += new EventHandler(focusLost); settings += option.Width + 10; }
private async void pictureClick(object o, MouseEventArgs e) { if (!viewingImage || globalSettings["MultiSelect"].Equals("Yes")) { FancyLabel leb = (FancyLabel)o; if (globalSettings["MultiSelect"].Equals("No")) { if (fullImages.ContainsKey(leb.Name)) { backgroundBack.Image = fullImages[leb.Name]; } else if (leb.Text.Equals("") || leb.Text == null) { backgroundBack.Image = loading.Image; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += (b, w) => { WebClient client = new WebClient(); /*client.DownloadProgressChanged += (cl, lc) => { lc.ProgressPercentage };*/ try { byte[] bFile = client.DownloadData(leb.Name); MemoryStream ms = new MemoryStream(bFile); Image img = Image.FromStream(ms); fullImages.Add(leb.Name, (Bitmap)img); } catch (Exception eee) { } }; bw.RunWorkerCompleted += (b, w) => { if (clickedImage.Name.Equals(leb.Name) && viewingImage) { Invoke((MethodInvoker)delegate { backgroundBack.Image = fullImages[leb.Name]; }); } }; bw.RunWorkerAsync(); } } if (globalSettings["MultiSelect"].Equals("Yes")) { if (leb.BorderStyle == BorderStyle.Fixed3D) { multi.Remove(leb); leb.BorderStyle = BorderStyle.None; return; } else { multi.Add(leb); } } viewingImage = true; clickedImage = leb; leb.BorderStyle = BorderStyle.Fixed3D; Control console = Controls.Find("console", true)[0]; int yAmt = 0; Control[] ctrl = Controls.Find("black", true); FancyLabel black; if (ctrl.Count() == 0) { black = new FancyLabel(); black.BackColor = Color.FromArgb(0, 0, 0, 0); black.Size = Size; black.Visible = true; black.Name = "black"; black.Parent = backgroundBack; black.Location = new Point(0, 0); backgroundBack.Controls.Add(black); } else { black = (FancyLabel) ctrl[0]; } black.Visible = true; black.BringToFront(); leb.BringToFront(); menu.BringToFront(); if (globalSettings["MultiSelect"].Equals("Yes")) { opacity.BringToFront(); foreach (Control cc in backgroundBack.Controls) { if (cc.Name.Contains("worlds")) { cc.BringToFront(); } } } foreach (string s in new string[] { "Copy to Clipboard", "Open", "Download", "Set as Desktop", "Delete", "Cancel" }) { Control[] ctrls = Controls.Find("PictureOption" + s, true); if (ctrls.Count() == 0) { FancyLabel option = new FancyLabel(); option.Name = "PictureOption" + s; option.AutoSize = true; option.Font = new Font("Lithos Pro Regular", 17); option.Location = new Point(console.Location.X + 10, 200 - yAmt); option.Parent = backgroundBack; option.BackColor = Color.Purple; option.ForeColor = Color.White; option.Text = s; option.Visible = true; option.Enabled = true; backgroundBack.Controls.Add(option); option.BringToFront(); yAmt += 10 + option.Size.Height; Control cont = (Control)option; cont.MouseDown += new MouseEventHandler(onMouseDown); cont.LostFocus += new EventHandler(onLabelLoseFocus); cont.MouseEnter += new EventHandler(focusGained); cont.MouseLeave += new EventHandler(focusLost); } else { ctrls[0].Visible = true; ctrls[0].Enabled = true; ctrls[0].BringToFront(); } } Controls.Find("PictureOptionDelete", true)[0].Text = "Delete"; if (multi.Count() <= 1) { for (int i = 5; i <= 200; i += 10) { black.BackColor = Color.FromArgb(i, 0, 0, 0); if (!shittyComputerMode) { await Task.Delay(10); } } } } }