Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Screen_Recorder
- {
- public partial class RecordingToolBar : UserControl
- {
- private Button btnFullScreen;
- private Button btnSpeaker;
- private Button btnMic;
- private Button btnRec;
- public RecordingToolBar()
- {
- InitializeComponent();
- InitializeComponents();
- ApplyCustomStyling();
- }
- private void InitializeComponents()
- {
- this.Size = new Size(800, 60); // Adjust size accordingly
- this.BackColor = Color.Black;
- btnFullScreen = new Button
- {
- Text = "Full Screen",
- Location = new Point(10, 15),
- Size = new Size(100, 30),
- ForeColor = Color.White,
- FlatStyle = FlatStyle.Flat,
- };
- btnSpeaker = CreateToggleButton("Speaker ON", new Point(120, 15));
- btnMic = CreateToggleButton("Mic OFF", new Point(230, 15));
- btnRec = new Button
- {
- Size = new Size(50, 50),
- Location = new Point(340, 5),
- BackColor = Color.DarkRed,
- Image = Image.FromFile(@"d:\icons\icons8-record-32.png"), // Ensure the path is correct
- };
- this.Controls.Add(btnFullScreen);
- this.Controls.Add(btnSpeaker);
- this.Controls.Add(btnMic);
- this.Controls.Add(btnRec);
- }
- private Button CreateToggleButton(string text, Point location)
- {
- return new Button
- {
- Text = text,
- Location = location,
- Size = new Size(100, 30),
- ForeColor = Color.White,
- FlatStyle = FlatStyle.Flat,
- BackColor = Color.Gray
- };
- }
- private void ApplyCustomStyling()
- {
- foreach (Control ctrl in Controls)
- {
- if (ctrl is Button btn)
- {
- btn.FlatAppearance.BorderSize = 0;
- btn.MouseEnter += (s, e) => btn.BackColor = Color.DarkGray;
- btn.MouseLeave += (s, e) => btn.BackColor = Color.Gray;
- }
- }
- }
- private void RecordingToolBar_Load(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment