📄 msnstyledrawer.cs
字号:
namespace Imps.Client.Pc.XControls
{
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class MsnStyleDrawer : IXTabDrawer
{
private void CalcScrollRectangle(XTabControl control, out Rectangle rectA, out Rectangle rectB)
{
Image scrollImageButton = null;
int width = 0;
int num2 = 0;
int x = 0;
int y = 0;
int tabWidth = control.TabWidth;
int tabHeight = control.TabHeight;
int borderWidth = control.BorderWidth;
Rectangle clientRectangle = control.ClientRectangle;
int num8 = clientRectangle.Width;
int height = clientRectangle.Height;
int tabCount = control.TabCount;
rectA = Rectangle.Empty;
rectB = Rectangle.Empty;
switch (control.Alignment)
{
case TabAlignment.Top:
case TabAlignment.Bottom:
break;
case TabAlignment.Left:
scrollImageButton = control.ScrollImageButton;
scrollImageButton.RotateFlip(RotateFlipType.Rotate90FlipX);
width = scrollImageButton.Width;
num2 = scrollImageButton.Height;
x = (tabWidth - width) / 2;
y = (clientRectangle.Y + height) - num2;
rectA = new Rectangle(x, y, width, num2 / 2);
rectB = new Rectangle(x, y + (num2 / 2), width, num2 / 2);
return;
case TabAlignment.Right:
scrollImageButton = control.ScrollImageButton;
scrollImageButton.RotateFlip(RotateFlipType.Rotate90FlipX);
width = scrollImageButton.Width;
num2 = scrollImageButton.Height;
break;
default:
return;
}
}
public void DrawBorder(Graphics g, XTabControl xTab)
{
Rectangle rect = xTab.XTabPageRectangle;
int x = rect.X;
int y = rect.Y;
int width = rect.Width;
int height = rect.Height;
int borderWidth = xTab.BorderWidth;
using (SolidBrush brush = new SolidBrush(xTab.SelectedTabBackColor))
{
using (Pen pen = new Pen(brush, float.Parse(xTab.BorderWidth.ToString())))
{
brush.Color = Color.White;
g.FillRectangle(brush, rect);
pen.Color = xTab.BorderColor;
Point[] points = new Point[] { new Point(x, y), new Point(x + width, y), new Point(x + width, y + height), new Point(x, y + height) };
g.DrawLines(pen, points);
}
}
}
public void DrawScrollButton(Graphics g, XTabControl xTab)
{
if (xTab.ScrollImageButton == null)
{
xTab.ScrollRectA = Rectangle.Empty;
xTab.ScrollRectB = Rectangle.Empty;
}
else
{
Image scrollImageButton = null;
int width = 0;
int height = 0;
int x = 0;
int y = 0;
int tabWidth = xTab.TabWidth;
int tabHeight = xTab.TabHeight;
int borderWidth = xTab.BorderWidth;
Rectangle clientRectangle = xTab.ClientRectangle;
int num8 = clientRectangle.Width;
int num7 = clientRectangle.Height;
switch (xTab.Alignment)
{
case TabAlignment.Left:
scrollImageButton = xTab.ScrollImageButton;
scrollImageButton.RotateFlip(RotateFlipType.Rotate90FlipX);
width = scrollImageButton.Width;
height = scrollImageButton.Height;
x = (tabWidth - width) / 2;
y = (clientRectangle.Y + num7) - height;
xTab.ScrollRectA = new Rectangle(x, y, width, height / 2);
xTab.ScrollRectB = new Rectangle(x, y + (height / 2), width, height / 2);
break;
case TabAlignment.Right:
scrollImageButton = xTab.ScrollImageButton;
scrollImageButton.RotateFlip(RotateFlipType.Rotate90FlipX);
width = scrollImageButton.Width;
height = scrollImageButton.Height;
break;
}
g.DrawImage(scrollImageButton, x, y, width, height);
if (xTab.MouseInRectA)
{
using (SolidBrush brush = new SolidBrush(xTab.BorderColor))
{
using (Pen pen = new Pen(brush))
{
g.DrawRectangle(pen, x, y, xTab.ScrollRectA.Width - borderWidth, xTab.ScrollRectB.Height - borderWidth);
}
}
}
if (xTab.MouseInRectB)
{
using (SolidBrush brush2 = new SolidBrush(xTab.BorderColor))
{
using (Pen pen2 = new Pen(brush2))
{
g.DrawRectangle(pen2, x, xTab.ScrollRectB.Y, xTab.ScrollRectB.Width - borderWidth, xTab.ScrollRectB.Height - (borderWidth * 2));
}
}
}
}
}
public void DrawTabs(Graphics g, XTabControl xTab)
{
using (SolidBrush brush = new SolidBrush(xTab.BorderColor))
{
using (SolidBrush brush2 = new SolidBrush(xTab.HoverTabBackColor))
{
using (SolidBrush brush3 = new SolidBrush(xTab.SelectedTabBackColor))
{
using (Pen pen = new Pen(brush, float.Parse(xTab.BorderWidth.ToString())))
{
int tabCount = xTab.TabCount;
XTabPage page = null;
Image tabImage = null;
Rectangle rect = xTab.ClientRectangle;
int x = rect.X;
int y = rect.Y;
int width = rect.Width;
int height = rect.Height;
int tabWidth = xTab.TabWidth;
int tabHeight = xTab.TabHeight;
int borderWidth = xTab.BorderWidth;
int selectedIndex = xTab.SelectedIndex;
int hoverIndex = xTab.HoverIndex;
int currentOffSet = xTab.CurrentOffSet;
int num11 = 0;
int num12 = 0;
int num13 = 0;
int num14 = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -