gpt4 book ai didi

c# - 如何在 SplitContainer 的 Splitter 中添加抓取 handle

转载 作者:可可西里 更新时间:2023-11-01 03:11:36 25 4
gpt4 key购买 nike

SplitContainer 的分隔栏中曾经有 3 个点。就像StackOverflow上的question details文本框有三行表示可以抓取。我如何在 .NET 中使用 SplitContainer 的分隔条来做到这一点?

最佳答案

并不是说我反对 Alex 的回答,但我想我会分享这个解决方案,因为它看起来对我来说更好一些(无论如何在 XP 机器上?)。

private void SplitContainer_Paint(object sender, PaintEventArgs e)
{
var control = sender as SplitContainer;
//paint the three dots'
Point[] points = new Point[3];
var w = control.Width;
var h = control.Height;
var d = control.SplitterDistance;
var sW = control.SplitterWidth;

//calculate the position of the points'
if (control.Orientation == Orientation.Horizontal)
{
points[0] = new Point((w / 2), d + (sW / 2));
points[1] = new Point(points[0].X - 10, points[0].Y);
points[2] = new Point(points[0].X + 10, points[0].Y);
}
else
{
points[0] = new Point(d + (sW / 2), (h / 2));
points[1] = new Point(points[0].X, points[0].Y - 10);
points[2] = new Point(points[0].X, points[0].Y + 10);
}

foreach (Point p in points)
{
p.Offset(-2, -2);
e.Graphics.FillEllipse(SystemBrushes.ControlDark,
new Rectangle(p, new Size(3, 3)));

p.Offset(1, 1);
e.Graphics.FillEllipse(SystemBrushes.ControlLight,
new Rectangle(p, new Size(3, 3)));
}
}

希望这能让人高兴?哈!

关于c# - 如何在 SplitContainer 的 Splitter 中添加抓取 handle ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4187225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com