How to use Show method of FlaUI.Core.Overlay.WinFormsOverlayManager class

Best FlaUI code snippet using FlaUI.Core.Overlay.WinFormsOverlayManager.Show

WinFormsOverlayManager.cs

Source:WinFormsOverlayManager.cs Github

copy

Full Screen

...13 {14 Size = 3;15 Margin = 0;16 }17 public void Show(Rectangle rectangle, Color color, int durationInMs)18 {19 if (!rectangle.IsEmpty)20 {21#if NET3522 new Thread(() =>23 {24 CreateAndShowForms(rectangle, color, durationInMs);25 }).Start();26#elif NET4027 System.Threading.Tasks.Task.Factory.StartNew(() => {28 CreateAndShowForms(rectangle, color, durationInMs);29 });30#else31 System.Threading.Tasks.Task.Run(() => CreateAndShowForms(rectangle, color, durationInMs));32#endif33 }34 }35 public void ShowBlocking(Rectangle rectangle, Color color, int durationInMs)36 {37 CreateAndShowForms(rectangle, color, durationInMs);38 }39 private void CreateAndShowForms(Rectangle rectangle, Color color, int durationInMs)40 {41 var leftBorder = new Rectangle(rectangle.X - Margin, rectangle.Y - Margin, Size, rectangle.Height + 2 * Margin);42 var topBorder = new Rectangle(rectangle.X - Margin, rectangle.Y - Margin, rectangle.Width + 2 * Margin, Size);43 var rightBorder = new Rectangle(rectangle.X + rectangle.Width - Size + Margin, rectangle.Y - Margin, Size, rectangle.Height + 2 * Margin);44 var bottomBorder = new Rectangle(rectangle.X - Margin, rectangle.Y + rectangle.Height - Size + Margin, rectangle.Width + 2 * Margin, Size);45 var allBorders = new[] { leftBorder, topBorder, rightBorder, bottomBorder };46 var gdiColor = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);47 var forms = new List<OverlayRectangleForm>();48 foreach (var border in allBorders)49 {50 var form = new OverlayRectangleForm { BackColor = gdiColor };51 forms.Add(form);52 // Position the window53 User32.SetWindowPos(form.Handle, new IntPtr(-1), border.X, border.Y,54 border.Width, border.Height, SetWindowPosFlags.SWP_NOACTIVATE);55 // Show the window56 User32.ShowWindow(form.Handle, ShowWindowTypes.SW_SHOWNA);57 }58 Thread.Sleep(durationInMs);59 foreach (var form in forms)60 {61 // Cleanup62 form.Hide();63 form.Close();64 form.Dispose();65 }66 }67 public void Dispose()68 {69 // Nothing to dispose70 }...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run FlaUI automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in WinFormsOverlayManager

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful