📄 bgrouplistcontroltoolbar.cs
字号:
namespace Imps.Client.Pc.Controls
{
using Imps.Client.Pc;
using Imps.Client.Pc.WndlessControls;
using Imps.Client.Utils;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
public class BGroupListControlToolbar : UserControl
{
private WndlessButton _btnCreate;
private WndlessButton _btnSearch;
private WndlessControlCollection _wndlessControls;
private IContainer components;
private XTrackBar ctlDisplayMode;
public BGroupListControlToolbar()
{
this.set_DoubleBuffered(true);
this.InitializeComponent();
this.InitializeWndlessComponent();
this.LoadDefaultResource();
this.TryLoadStyle();
this.AdjustChildControls();
ListControlToolbarStyle.Instance.StyleChanged += new EventHandler(this.Instance_StyleChanged);
}
public void AdjustChildControls()
{
try
{
base.SuspendLayout();
int num = 2;
int x = base.Width - 1;
int y = 0;
x -= this.ctlDisplayMode.Width;
y = (base.Height - this.ctlDisplayMode.Height) / 2;
this.ctlDisplayMode.SetBounds(x, y, 0, 0, BoundsSpecified.Location);
x = 4;
y = (base.Height - this._btnCreate.Height) / 2;
this._btnCreate.SetBounds(x, y, 0, 0, BoundsSpecified.Location);
x = this._btnCreate.Right + num;
this._btnSearch.SetBounds(x, y, 0, 0, BoundsSpecified.Location);
}
catch
{
}
finally
{
base.ResumeLayout();
}
}
protected override void Dispose(bool disposing)
{
ListControlToolbarStyle.Instance.StyleChanged -= new EventHandler(this.Instance_StyleChanged);
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.ctlDisplayMode = new XTrackBar();
base.SuspendLayout();
this.ctlDisplayMode.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.ctlDisplayMode.BackColor = Color.Transparent;
this.ctlDisplayMode.BarInnerColor = Color.FromArgb(8, 0x33, 0x5d);
this.ctlDisplayMode.BarOuterColor = Color.FromArgb(8, 0x33, 0x5d);
this.ctlDisplayMode.ColorSchema = XTrackBar.ColorSchemas.Fetion;
this.ctlDisplayMode.LargeChange = 1;
this.ctlDisplayMode.Location = new System.Drawing.Point(0xb9, 1);
this.ctlDisplayMode.Maximum = 1;
this.ctlDisplayMode.Name = "ctlDisplayMode";
this.ctlDisplayMode.Size = new Size(0x43, 20);
this.ctlDisplayMode.SmallChange = 1;
this.ctlDisplayMode.TabIndex = 1;
this.ctlDisplayMode.TabStop = false;
this.ctlDisplayMode.ThumbInnerColor = Color.FromArgb(0xba, 0xbf, 0xc5);
this.ctlDisplayMode.ThumbPenColor = Color.FromArgb(20, 0x53, 0x88);
this.ctlDisplayMode.ThumbSize = 6;
this.ctlDisplayMode.Value = 0;
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.Controls.Add(this.ctlDisplayMode);
base.Name = "BListControlToolbar";
base.Size = new Size(0xfc, 0x17);
this.set_MinimumSize(new Size(230, 0x17));
base.ResumeLayout(false);
}
private void InitializeWndlessComponent()
{
try
{
this._wndlessControls = new WndlessControlCollection(this);
this._btnSearch = new WndlessButton();
this._btnSearch.AutoSize = true;
this._btnSearch.Text = "搜索群";
this._btnSearch.ForeColor = Color.White;
this._btnCreate = new WndlessButton();
this._btnCreate.AutoSize = true;
this._btnCreate.Text = "创建群";
this._btnCreate.ForeColor = Color.White;
this._wndlessControls.Add(this._btnSearch);
this._wndlessControls.Add(this._btnCreate);
}
catch (Exception exception)
{
Trace.WriteLine(exception.ToString());
}
}
private void Instance_StyleChanged(object sender, EventArgs e)
{
this.TryLoadStyle();
}
private void LoadDefaultResource()
{
try
{
Assembly asm = Assembly.GetCallingAssembly();
this._btnSearch.Image = ResourceHelper.GetResImage(asm, "Imps.Client.Pc.Resource.GroupListToolbar_Search.png");
this._btnCreate.Image = ResourceHelper.GetResImage(asm, "Imps.Client.Pc.Resource.GroupListToolbar_Create.png");
this.DisplayModeTrackBar.set_Padding(new Padding(5, 10, 4, 1));
}
catch (Exception exception)
{
Trace.WriteLine(exception.ToString());
}
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
if (this.BackgroundImage != null)
{
Imps.Client.Utils.DrawHelper.DrawImage(g, base.ClientRectangle, this.BackgroundImage, 1);
}
else
{
using (Brush brush = new SolidBrush(this.BackColor))
{
g.FillRectangle(brush, base.ClientRectangle);
}
}
base.OnPaint(e);
}
public void SetDisplayModeTrackBarBackground(Image img)
{
this.ctlDisplayMode.BackgroundImage = img;
this.ctlDisplayMode.set_BackgroundImageLayout(0);
this.ctlDisplayMode.Size = img.Size;
}
private void TryLoadStyle()
{
try
{
Assembly asm = Assembly.GetCallingAssembly();
Image img = ListControlToolbarStyle.Instance.GroupTrackerImage ?? ResourceHelper.GetResImage(asm, "Imps.Client.Pc.Resource.Tracker_Group.png");
this.SetDisplayModeTrackBarBackground(img);
if (((ListControlToolbarStyle.Instance.ThumbInnerColor == Color.Transparent) || (ListControlToolbarStyle.Instance.ThumbOuterColor == Color.Transparent)) || (((ListControlToolbarStyle.Instance.ThumbPenColor == Color.Transparent) || (ListControlToolbarStyle.Instance.BarInnerColor == Color.Transparent)) || (ListControlToolbarStyle.Instance.BarOuterColor == Color.Transparent)))
{
this.DisplayModeTrackBar.ColorSchema = XTrackBar.ColorSchemas.Fetion;
}
else
{
this.DisplayModeTrackBar.ThumbOuterColor = ListControlToolbarStyle.Instance.ThumbOuterColor;
this.DisplayModeTrackBar.ThumbInnerColor = ListControlToolbarStyle.Instance.ThumbInnerColor;
this.DisplayModeTrackBar.BarOuterColor = ListControlToolbarStyle.Instance.BarOuterColor;
this.DisplayModeTrackBar.BarInnerColor = ListControlToolbarStyle.Instance.BarInnerColor;
this.DisplayModeTrackBar.ThumbPenColor = ListControlToolbarStyle.Instance.ThumbPenColor;
}
}
catch
{
}
}
public Image BackgroundImage
{
get
{
Assembly.GetCallingAssembly();
return ListControlToolbarStyle.Instance.BackgoundImage;
}
}
public WndlessButton CreateGroupButton
{
get
{
return this._btnCreate;
}
}
public XTrackBar DisplayModeTrackBar
{
get
{
return this.ctlDisplayMode;
}
}
public WndlessButton SearchGroupButton
{
get
{
return this._btnSearch;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -