private async void FadeOut(FadeControl o, int interval = 80) { button2.Visible = false; button3.Visible = false; button4.Visible = false; //Object is fully visible. Fade it out while (o.Opacity > 1) { await Task.Delay(interval); o.Opacity -= 3; } o.Opacity = 0; //make fully invisible }
private async void FadeIn(FadeControl o, int interval = 80) { button2.Visible = true; button3.Visible = true; button4.Visible = true; //Object is not fully invisible. Fade it in while (o.Opacity < 99) { await Task.Delay(interval); o.Opacity += 3; //o.Opacity += 0.03; } o.Opacity = 100; //make fully visible }
private void Form1_Load(object sender, EventArgs e) { this.DoubleBuffered = true; garbagePanel.SendToBack(); TFLP = new FadeControl(); TFLP.Size = garbagePanel.Size; TFLP.Location = garbagePanel.Location; TFLP.DragEnter += new DragEventHandler(flowLayoutPanel_DragEnter); TFLP.DragDrop += new DragEventHandler(flowLayoutPanel_DragDrop); TFLP.Visible = true; //TFLP.Opacity = 20; TFLP.BackColor = System.Drawing.SystemColors.Control; TFLP.AllowDrop = true; //TFLP.AutoScroll = true; //TFLP.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; //TFLP.BackgroundImage = global::Test.Properties.Resources.qcBXKrARi; //TFLP.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; //TFLP.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; TFLP.BringToFront(); this.Controls.Add(TFLP); TFLP.BringToFront(); // garbagePanel.DragEnter += new DragEventHandler(flowLayoutPanel_DragEnter); //garbagePanel.DragDrop += new DragEventHandler(flowLayoutPanel_DragDrop); this.MouseUp += new MouseEventHandler(FadeIn_MouseUp); button2.BringToFront(); button3.BringToFront(); button4.BringToFront(); /* * * Random r = new Random(); * Size s = new Size(flowLayoutPanel1.Width - 8, 47); * System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); * dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; * * for (int i = 0; i < 10; i++) * { * PB PBA = new PB(); * PBA.ReadOnly = true; * PBA.AllowDrag = true; * PBA.RowHeadersVisible = false; * PBA.Columns.Add("test", " " + (r.Next(300000, 400000)).ToString());//, "Foo Text"); * //PBA.Rows[0].HeaderCell.Value = "Row Text"; * PBA.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; * //PBA.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; * //PBA.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; * //PBA.AutoSize = true; * PBA.DefaultCellStyle.SelectionBackColor = Color.White; * PBA.DefaultCellStyle.ForeColor = Color.Black; * PBA.Dock = DockStyle.Top; * PBA.Size = s; * //PBA.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; * PBA.Columns["test"].DefaultCellStyle = dataGridViewCellStyle2; * PBA.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; * this.flowLayoutPanel1.Controls.Add(PBA); * } * * Size s = new Size(flowLayoutPanel1.Width, 50); * HarrProgressBar pgb; * * pgb = new HarrProgressBar(); * pgb.Padding = new Padding(5); * pgb.LeftText = "1"; * pgb.MainText = "47x100x5400 - 20/100"; * pgb.FillDegree = 20; * pgb.RightText = "1"; * pgb.StatusText = "Raw"; * pgb.StatusBarColor = 0; * pgb.Size = s; * pgb.Anchor = AnchorStyles.Left | AnchorStyles.Right; * pgb.MouseDoubleClick += new MouseEventHandler(Double_Click); * * this._items.Add(pgb); * this.flowLayoutPanel1.Controls.Add(pgb); * * pgb = new HarrProgressBar(); * pgb.Padding = new Padding(5); * pgb.LeftText = "2"; * pgb.MainText = "32x150x3300 - 40/100"; * pgb.FillDegree = 40; * pgb.RightText = "2"; * pgb.StatusText = "Raw inactive"; * pgb.StatusBarColor = 1; * pgb.Size = s; * pgb.MouseDoubleClick += new MouseEventHandler(Double_Click); * this._items.Add(pgb); * this.flowLayoutPanel1.Controls.Add(pgb); * * pgb = new HarrProgressBar(); * pgb.Padding = new Padding(5); * pgb.LeftText = "3"; * pgb.MainText = "22x100x2700 - 85/100"; * pgb.FillDegree = 85; * pgb.RightText = "3"; * pgb.StatusText = "Dry"; * pgb.StatusBarColor = 2; * pgb.Size = s; * pgb.MouseDoubleClick += new MouseEventHandler(Double_Click); * this._items.Add(pgb); * this.flowLayoutPanel1.Controls.Add(pgb); * * pgb = new HarrProgressBar(); * pgb.Padding = new Padding(5); * pgb.LeftText = "4"; * pgb.MainText = "47x200x4700 - 95/100"; * pgb.FillDegree = 95; * pgb.RightText = "4"; * pgb.StatusText = "Dry inactive"; * pgb.StatusBarColor = 3; * pgb.Size = s; * pgb.MouseDoubleClick += new MouseEventHandler(Double_Click); * this._items.Add(pgb); * this.flowLayoutPanel2.Controls.Add(pgb); * * pgb = new HarrProgressBar(); * pgb.Padding = new Padding(5); * pgb.LeftText = "5"; * pgb.MainText = "47x200x4700 - 100/100"; * pgb.FillDegree = 100; * pgb.RightText = "5"; * pgb.Size = s; * pgb.MouseDoubleClick += new MouseEventHandler(Double_Click); * this._items.Add(pgb); * this.flowLayoutPanel2.Controls.Add(pgb); * */ }