Chocolade19721309

Untitled

May 4th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Screen_Recorder
  12. {
  13. public partial class RecordingToolBar : UserControl
  14. {
  15. private Button btnFullScreen;
  16. private Button btnSpeaker;
  17. private Button btnMic;
  18. private Button btnRec;
  19.  
  20. public RecordingToolBar()
  21. {
  22. InitializeComponent();
  23.  
  24. InitializeComponents();
  25. ApplyCustomStyling();
  26. }
  27.  
  28. private void InitializeComponents()
  29. {
  30. this.Size = new Size(800, 60); // Adjust size accordingly
  31. this.BackColor = Color.Black;
  32.  
  33. btnFullScreen = new Button
  34. {
  35. Text = "Full Screen",
  36. Location = new Point(10, 15),
  37. Size = new Size(100, 30),
  38. ForeColor = Color.White,
  39. FlatStyle = FlatStyle.Flat,
  40. };
  41. btnSpeaker = CreateToggleButton("Speaker ON", new Point(120, 15));
  42. btnMic = CreateToggleButton("Mic OFF", new Point(230, 15));
  43.  
  44. btnRec = new Button
  45. {
  46. Size = new Size(50, 50),
  47. Location = new Point(340, 5),
  48. BackColor = Color.DarkRed,
  49. Image = Image.FromFile(@"d:\icons\icons8-record-32.png"), // Ensure the path is correct
  50. };
  51.  
  52. this.Controls.Add(btnFullScreen);
  53. this.Controls.Add(btnSpeaker);
  54. this.Controls.Add(btnMic);
  55. this.Controls.Add(btnRec);
  56. }
  57.  
  58. private Button CreateToggleButton(string text, Point location)
  59. {
  60. return new Button
  61. {
  62. Text = text,
  63. Location = location,
  64. Size = new Size(100, 30),
  65. ForeColor = Color.White,
  66. FlatStyle = FlatStyle.Flat,
  67. BackColor = Color.Gray
  68. };
  69. }
  70.  
  71. private void ApplyCustomStyling()
  72. {
  73. foreach (Control ctrl in Controls)
  74. {
  75. if (ctrl is Button btn)
  76. {
  77. btn.FlatAppearance.BorderSize = 0;
  78. btn.MouseEnter += (s, e) => btn.BackColor = Color.DarkGray;
  79. btn.MouseLeave += (s, e) => btn.BackColor = Color.Gray;
  80. }
  81. }
  82. }
  83.  
  84. private void RecordingToolBar_Load(object sender, EventArgs e)
  85. {
  86.  
  87. }
  88. }
  89. }
  90.  
Advertisement
Add Comment
Please, Sign In to add comment