Source/AdvTree/Design/ElementStyleTypeEditor.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using System.Windows.Forms;
using System.ComponentModel.Design;
using DevComponents.DotNetBar;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents type editor for ElementStyle used for Windows Forms design-time support.
/// </summary>
public class ElementStyleTypeEditor:System.Drawing.Design.UITypeEditor
{
#region Private Variables
private IWindowsFormsEditorService m_EditorService = null;
private const string OPTION_CREATE="Create style";
private const string OPTION_REMOVE="Delete selected style";
private const string OPTION_STYLES="Styles.";
#endregion
#region Internal Implementation
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
ElementStyle es=value as ElementStyle;
m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if(m_EditorService!=null)
{
AdvTree tree = null;
if(context.Instance is AdvTree)
tree=context.Instance as AdvTree;
else if(context.Instance is Node)
tree=((Node)context.Instance).TreeControl;
else if(context.Instance is Cell)
tree=((Cell)context.Instance).TreeControl;
ListBox lb=new ListBox();
if(es==null)
lb.Items.Add(OPTION_CREATE);
else
lb.Items.Add(OPTION_REMOVE);
if(tree!=null)
{
foreach(ElementStyle style in tree.Styles)
lb.Items.Add(style);
}
string[] styles = Enum.GetNames(typeof (ePredefinedElementStyle));
foreach(string s in styles)
lb.Items.Add(OPTION_STYLES + s);
后面还有 91 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。