📄 imsplitcontainer.cs
字号:
namespace Imps.Client.Pc.BizControls.Conversation
{
using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
public class IMSplitContainer : SplitContainer
{
protected Color borderColor;
private Pen pen;
protected Image splitImage;
public IMSplitContainer()
{
this.borderColor = Color.FromArgb(0xc4, 0xc4, 0xc4);
base.set_SplitterWidth(9);
base.SetStyle(0x20012, true);
this.Init();
}
public IMSplitContainer(Image splitImage)
{
this.borderColor = Color.FromArgb(0xc4, 0xc4, 0xc4);
this.SpliteImage = splitImage;
this.Init();
}
private Point CalculatePoint()
{
int x;
int y;
if (base.get_Orientation() == Orientation.Horizontal)
{
y = base.get_SplitterDistance() + ((base.get_SplitterWidth() - this.SpliteImage.Height) / 2);
x = (base.Width - this.SpliteImage.Width) / 2;
}
else
{
x = base.get_SplitterDistance() + ((base.get_SplitterWidth() - this.SpliteImage.Width) / 2);
y = (base.Height - this.SpliteImage.Height) / 2;
}
return new Point(x, y);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
this.pen.Dispose();
}
private void Init()
{
base.set_SplitterWidth(9);
this.pen = new Pen(this.borderColor, 1f);
base.get_Panel1().Paint += new PaintEventHandler(this.Panel1_Paint);
base.get_Panel2().Paint += new PaintEventHandler(this.Panel2_Paint);
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics graphics = e.Graphics;
if (this.SpliteImage == null)
{
Type type = typeof(IMSplitContainer);
Stream manifestResourceStream = Assembly.GetAssembly(type).GetManifestResourceStream("Imps.Client.Pc.BizControls.Conversation.spliter.png");
this.SpliteImage = Image.FromStream(manifestResourceStream);
}
Point point = this.CalculatePoint();
graphics.DrawImage(this.SpliteImage, point.X, point.Y, this.SpliteImage.Width, this.SpliteImage.Height);
}
private void Panel1_Paint(object sender, PaintEventArgs e)
{
this.pen.Color = this.borderColor;
this.pen.Width = 1f;
e.Graphics.DrawRectangle(this.pen, 0, 0, base.get_Panel1().get_Width() - 1, base.get_Panel1().get_Height() - 1);
}
private void Panel2_Paint(object sender, PaintEventArgs e)
{
this.pen.Color = this.borderColor;
this.pen.Width = 1f;
e.Graphics.DrawRectangle(this.pen, 0, 0, base.get_Panel2().get_Width() - 1, base.get_Panel2().get_Height() - 1);
}
public Color BorderColor
{
get
{
return this.borderColor;
}
set
{
this.borderColor = value;
}
}
public Image SpliteImage
{
get
{
return this.splitImage;
}
set
{
this.splitImage = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -