温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:HeroBeastControls的NavMenu导航控件Demo及源码
当前文件路径:HeroBeastControlsNavMenu/NavMenu/Designer/NavMenuDesigner.cs

1using System; 2
using System.Collections.Generic; 3
using System.Text; 4
using System.Web.UI.Design; 5
using System.IO; 6
using System.Web.UI; 7
using System.Web.UI.HtmlControls; 8
using System.ComponentModel.Design; 9
using System.ComponentModel; 10
using System.Drawing.Design; 11
12
namespace HeroBeastControls.NavMenu 13
{ 14
public class NavMenuDesigner : ControlDesigner 15
{ 16
17
public override string GetDesignTimeHtml() 18
{ 19
return base.GetDesignTimeHtml(); 20
} 21
public override bool AllowResize 22
{ 23
get { return true; } 24
} 25
26
DesignerActionListCollection _actionLists; 27
public override DesignerActionListCollection ActionLists 28
{ 29
get 30
{ 31
if (_actionLists == null) 32
{ 33
_actionLists = new DesignerActionListCollection(); 34
_actionLists.AddRange(base.ActionLists); 35
_actionLists.Add(new NavMenuActionList(this)); 36
} 37
return _actionLists; 38
} 39
} 40
} 41
class NavMenuActionList : DesignerActionList 42
{ 43
NavMenuDesigner _designer; 44
45
public NavMenuActionList(NavMenuDesigner designer) 46
: base(designer.Component) 47
{ 48
_designer = designer; 49
} 50
51
public override DesignerActionItemCollection GetSortedActionItems() 52
{ 53
DesignerActionItemCollection list = new DesignerActionItemCollection(); 54
list.Add(new DesignerActionTextItem("查看选择面板", "ShowPanel")); 55
list.Add(new DesignerActionPropertyItem("CssFilePath", "Css文件路径:", "NavMenu")); 56
list.Add(new DesignerActionPropertyItem("ListItems", "ListItems:", "NavMenu")); 57
return list; 58
} 59
60
[Editor(typeof(CssUrlEditor), typeof(UITypeEditor))] 61
public string CssFilePath 62
{ 63
get 64
{ 65
return (Component as NavMenu).CssFilePath; 66
} 67
set 68
{ 69
TypeDescriptor.GetProperties(Component)["CssFilePath"].SetValue(Component, value); 70
_designer.UpdateDesignTimeHtml(); 71
} 72
} 73
74
public NavMenuItems ListItems 75
{ 76
get 77
{ 78
return (Component as NavMenu).ListItems; 79
} 80
set 81
{ 82
TypeDescriptor.GetProperties(Component)["ListItems"].SetValue(Component, value); 83
_designer.UpdateDesignTimeHtml(); 84
} 85
} 86
} 87
} 88





}
}