Source/AdvTree/Design/NodeDesigner.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents Windows Forms designer for Node object.
/// </summary>
public class NodeDesigner:ComponentDesigner
{
/// <summary>
/// Initializes designer with given component.
/// </summary>
/// <param name="component">Component to initialize designer with.</param>
public override void Initialize(IComponent component)
{
base.Initialize(component);
if(!component.Site.DesignMode)
return;
ISelectionService ss =(ISelectionService)GetService(typeof(ISelectionService));
if(ss!=null)
ss.SelectionChanged+=new EventHandler(OnSelectionChanged);
Node n=component as Node;
if(n!=null)
this.Visible=n.Visible;
}
private void OnSelectionChanged(object sender, EventArgs e)
{
ISelectionService ss = (ISelectionService)sender;
if (this.Component != null && ss.PrimarySelection != this.Component)
{
Node node = this.Component as Node;
if (ss.PrimarySelection is Node)
{
Node selected = ss.PrimarySelection as Node;
if (selected.TreeControl != node.TreeControl)
{
node.TreeControl.SelectedNode = null;
}
}
else if (node != null && node.TreeControl != null)
node.TreeControl.SelectedNode = null;
}
}
protected override void PreFilterProperties(System.Collections.IDictionary properties)
{
base.PreFilterProperties(properties);
properties["Visible"] = TypeDescriptor.CreateProperty(typeof(NodeDesigner),(PropertyDescriptor)properties["Visible"], new Attribute[]
{
new DefaultValueAttribute(true),
new BrowsableAttribute(true),
new CategoryAttribute("Layout")});
后面还有 147 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。