Little Registry Cleaner/Common Tools/TreeViewAdv/Tree/NodeControls/NodeTextBox.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
using System.ComponentModel;
namespace Common_Tools.TreeViewAdv.Tree.NodeControls
{
public class NodeTextBox : BaseTextControl
{
private const int MinTextBoxWidth = 30;
public NodeTextBox()
{
}
protected override Size CalculateEditorSize(EditorContext context)
{
if (Parent.UseColumns)
return context.Bounds.Size;
else
{
Size size = GetLabelSize(context.CurrentNode, context.DrawContext, _label);
int width = Math.Max(size.Width + Font.Height, MinTextBoxWidth); // reserve a place for new typed character
return new Size(width, size.Height);
}
}
public override void KeyDown(KeyEventArgs args)
{
if (args.KeyCode == Keys.F2 && Parent.CurrentNode != null && EditEnabled)
{
args.Handled = true;
BeginEdit();
}
}
protected override Control CreateEditor(TreeNodeAdv node)
{
TextBox textBox = CreateTextBox();
textBox.TextAlign = TextAlign;
textBox.Text = GetLabel(node);
textBox.BorderStyle = BorderStyle.FixedSingle;
textBox.TextChanged += EditorTextChanged;
textBox.KeyDown += EditorKeyDown;
_label = textBox.Text;
SetEditControlProperties(textBox, node);
return textBox;
}
protected virtual TextBox CreateTextBox()
{
return new TextBox();
}
protected override void DisposeEditor(Control editor)
{
var textBox = editor as TextBox;
后面还有 66 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。