/// <summary> /// 添加控件方法 /// </summary> public override void onLoad() { base.onLoad(); if (m_designerTabPage == null) { m_designerTabPage = new FCTabPage(); addControl(m_designerTabPage); m_designerTabPage.BorderColor = FCColor.None; m_designerTabPage.HeaderButton.Size = new FCSize(60, 20); m_designerTabPage.HeaderButton.Margin = new FCPadding(1, -1, 0, 2); m_designerTabPage.ShowHScrollBar = true; m_designerTabPage.ShowVScrollBar = true; m_designerTabPage.Text = "设计"; m_designerTabPage.BackColor = FCColor.argb(75, 51, 153, 255); m_resizeDiv = new ResizeDiv(); m_resizeDiv.Native = Native; m_designerTabPage.addControl(m_resizeDiv); } if (m_sourceCodeTabPage == null) { m_sourceCodeTabPage = new FCTabPage(); m_sourceCodeTabPage.BorderColor = FCColor.None; //创建编辑器 m_scintilla = new ScintillaX(); m_scintilla.Visible = false; FCNative native = Native; WinHostEx host = native.Host as WinHostEx; Control container = Control.FromHandle(host.HWnd); container.Controls.Add(m_scintilla); m_scintilla.ParentDiv = m_sourceCodeTabPage; m_scintilla.TextChanged += new EventHandler <EventArgs>(scintilla_TextChanged); addControl(m_sourceCodeTabPage); m_sourceCodeTabPage.Text = "源"; m_sourceCodeTabPage.HeaderButton.Size = new FCSize(60, 20); m_sourceCodeTabPage.HeaderButton.Margin = new FCPadding(1, -1, 0, 2); } if (Parent != null) { Parent.addEvent(m_parentVisibleChangedEvent, FCEventID.VISIBLECHANGED); } SelectedIndex = 0; }
/// <summary> /// 创建控件 /// </summary> /// <param name="node">节点</param> /// <param name="type">类型</param> /// <returns>控件</returns> public override FCView createControl(XmlNode node, String type) { WinHostEx host = Native.Host as WinHostEx; if (host.LoadingDesigner) { //事件编辑 if (type == "eventgrid") { EventGrid eventGrid = new EventGrid(); eventGrid.Xml = this; return(eventGrid); } //属性编辑 else if (type == "propertygrid") { PropertyGrid propertyGrid = new PropertyGrid(); propertyGrid.Xml = this; return(propertyGrid); } //拖动层 else if (type == "resizediv") { ResizeDiv resizeDiv = new ResizeDiv(); resizeDiv.Xml = this; return(resizeDiv); } //工具箱 else if (type == "toolboxlist") { ToolBoxList toolBoxList = new ToolBoxList(); toolBoxList.Xml = this; return(toolBoxList); } //图片按钮 else if (type == "imagebutton") { return(new ImageButton()); } //透明按钮 else if (type == "ribbonbutton") { return(new RibbonButton()); } //透明按钮2 else if (type == "ribbonbutton2") { return(new RibbonButton2()); } //窗体 else if (type == "window") { return(new WindowEx()); } } else { //透明按钮 if (type == "ribbonbutton") { return(new RibbonButton()); } //透明按钮2 else if (type == "ribbonbutton2") { return(new RibbonButton2()); } } return(base.createControl(node, type)); }