/*------------------------------------------------------------------------------------------ * Button Handlers * -----------------------------------------------------------------------------------------*/ /* btnAdd_Click * Creates an instance of the New File form and displays it * Used answer from Idle_Mind on this thread: * https://stackoverflow.com/questions/27304874/creating-a-dark-background-when-a-new-form-appears * to give form a dark, disabled look */ private void btnNew_Click(object sender, EventArgs e) { // take a screenshot of the form and darken it: Bitmap bmp = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height); using (Graphics G = Graphics.FromImage(bmp)) { G.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; G.CopyFromScreen(this.PointToScreen(new Point(0, 0)), new Point(0, 0), this.ClientRectangle.Size); double percent = 0.60; Color darken = Color.FromArgb((int)(255 * percent), Color.Black); using (Brush brsh = new SolidBrush(darken)) { G.FillRectangle(brsh, this.ClientRectangle); } } using (Panel p = new Panel()) { p.Location = new Point(0, 0); p.Size = this.ClientRectangle.Size; p.BackgroundImage = bmp; this.Controls.Add(p); p.BringToFront(); // display your dialog somehow: frmNewFile nf = new frmNewFile(fs); nf.ShowDialog(); } // panel will be disposed and the form will "lighten" again... }
public frmAddLanguage(frmNewFile frmNewFile, List <String> languages) { InitializeComponent(); fnf = frmNewFile; langList = languages; }