ShadowStyles.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Diagnostics.Metrics;
  5. using System.Linq;
  6. using Terminal.Gui;
  7. namespace UICatalog.Scenarios;
  8. [ScenarioMetadata ("ShadowStyles Demo", "Demonstrates ShadowStyles Effects.")]
  9. [ScenarioCategory ("Layout")]
  10. public class ShadowStyles : Scenario
  11. {
  12. public override void Main ()
  13. {
  14. Application.Init ();
  15. Window app = new ()
  16. {
  17. Title = GetQuitKeyAndName ()
  18. };
  19. var editor = new AdornmentsEditor ()
  20. {
  21. AutoSelectViewToEdit = true,
  22. };
  23. app.Add (editor);
  24. Window win = new ()
  25. {
  26. X = Pos.Right (editor),
  27. Y = 0,
  28. Width = Dim.Percent (30),
  29. Height = Dim.Percent (30),
  30. Title = "Shadow Window",
  31. Arrangement = ViewArrangement.Movable,
  32. ShadowStyle = ShadowStyle.Transparent
  33. };
  34. var buttonInWin = new Button
  35. {
  36. X = Pos.Center (),
  37. Y = Pos.Center (), Text = "Button in Window",
  38. ShadowStyle = ShadowStyle.Opaque
  39. };
  40. win.Add (buttonInWin);
  41. app.Add (win);
  42. var button = new Button
  43. {
  44. X = Pos.Right (editor) + 10,
  45. Y = Pos.Center (), Text = "Button",
  46. ShadowStyle = ShadowStyle.Opaque
  47. };
  48. app.Add (button);
  49. Application.Run (app);
  50. app.Dispose ();
  51. Application.Shutdown ();
  52. return;
  53. }
  54. }