This repository has been archived on 2025-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
xerobrowser/WebBrowser/frmSettings.cs

144 lines
4.7 KiB
C#

using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
// using Bunifu.UI.WinForms;
namespace XeroBrowser
{
public partial class FrmSettings : Form
{
public FrmSettings()
{
InitializeComponent();
tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
tabControl1.Padding = new Point(15, 8);
tabControl1.Appearance = TabAppearance.FlatButtons;
tabControl1.ItemSize = new Size(0, 34);
tabControl1.SizeMode = TabSizeMode.Fixed;
}
private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
TabControl tabControl = (TabControl)sender;
TabPage tabPage = tabControl.TabPages[e.Index];
// Set the background color of the tab
using (Brush brush = new SolidBrush(Color.FromArgb(224, 224, 224)))
{
e.Graphics.FillRectangle(brush, e.Bounds);
}
// Draw the icon for the tab, if available
if (tabPage.ImageIndex >= 0)
{
Image icon = tabControl.ImageList.Images[tabPage.ImageIndex];
Rectangle iconRect = new Rectangle(e.Bounds.X + 6, e.Bounds.Y + 6, 20, 20);
e.Graphics.DrawImage(icon, iconRect);
}
// Draw the text for the tab
using (Brush brush = new SolidBrush(Color.Black))
{
Font font = new Font("Segoe UI", 9, FontStyle.Regular);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
Rectangle textRect = new Rectangle(e.Bounds.X + 28, e.Bounds.Y, e.Bounds.Width - 28, e.Bounds.Height);
e.Graphics.DrawString(tabPage.Text, font, brush, textRect, format);
}
}
private void bunifuDropdown1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void bunifuButton22_Click(object sender, EventArgs e)
{
Process.Start("ms-settings:network-proxy");
}
private void bunifuImageButton1_Click(object sender, EventArgs e)
{
Close();
}
private void bunifuTextBox1_TextChanged(object sender, EventArgs e)
{
bunifuRadioButton2.Checked = true;
bunifuRadioButton1.Checked = false;
}
private void btnBrowser_Click_1(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 0;
}
private void btnAppearance_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
private void btnPrivacy_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 2;
}
private void btnBehavior_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 3;
}
private void btnAutofill_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 4;
}
private void btnLanguages_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 5;
}
private void btnAccessibility_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 6;
}
private void bunifuToggleSwitch22_CheckedChanged(object sender, EventArgs e)
{
Config.SetEntry("RuffleActive", bunifuToggleSwitch22.Checked.ToString());
}
private void FrmSettings_Load(object sender, EventArgs e)
{
bunifuToggleSwitch22.Checked = Config.GetEntry("RuffleActive", "True") == "True";
bunifuDropdown1.Text = Config.GetEntry("SearchEngine", "Google");
bunifuDropdown2.Text = Config.GetEntry("Theme", "Match System");
bunifuToggleSwitch23.Checked = Config.GetEntry("RoundBorders", "True") == "True";
}
private void bunifuDropdown1_SelectedValueChanged(object sender, EventArgs e)
{
Config.SetEntry("SearchEngine", bunifuDropdown1.Text);
}
private void bunifuFormDock1_FormDragging(object sender, Bunifu.UI.WinForms.BunifuFormDock.FormDraggingEventArgs e)
{
}
private void bunifuDropdown2_SelectedValueChanged(object sender, EventArgs e)
{
Config.SetEntry("Theme", bunifuDropdown2.Text);
}
private void bunifuToggleSwitch23_CheckedChanged(object sender, EventArgs e)
{
Config.SetEntry("RoundBorders", bunifuToggleSwitch23.Checked.ToString());
}
}
}