static void ShowSplashForm(Screen screen, Rectangle rect, Action <string> callback, string link) { var qrSplash = new QRCodeSplashForm(); qrSplash.FormClosed += (s, e) => { callback(link); }; qrSplash.Location = new Point(screen.Bounds.X, screen.Bounds.Y); // qrSplash.Size = new Size(screen_size.X, screen_size.Y); qrSplash.TargetRect = rect; qrSplash.Size = screen.Bounds.Size; Debug.WriteLine("target: " + qrSplash.TargetRect); qrSplash.Show(); }
static void ShowSplashForm(Rectangle win, Rectangle target, Action done) { void ShowFormInBackground() { var qrSplash = new QRCodeSplashForm(); qrSplash.Location = win.Location; qrSplash.Size = win.Size; qrSplash.TargetRect = target; qrSplash.FormClosed += (s, a) => done(); try { qrSplash.Show(); } catch { } Application.Run(); } Task.Factory.StartNew(() => ShowFormInBackground()); }