/// <summary> /// 改变节点选择状态后 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewChannels_AfterCheck(object sender, TreeViewEventArgs e) { TreeNode node = e.Node; string channelId = node.Tag.ToString(); if (node.Checked) { NavigationPart nvPart = (NavigationPart)SnipPagePart.Create(SnipPageDesigner, SnipPartType.Navigation); nvPart.ChannelID = channelId; _navigations[channelId] = nvPart; nvPart.Width_Css = DEFAULTWIDTH; } else { _navigations.Remove(channelId); } if (_navigations.Values.Count <= 1) { checkBoxUsedSeparator.Checked = false; checkBoxUsedSeparator.Enabled = false; } else { checkBoxUsedSeparator.Enabled = true; } }
private void checkBoxProject_CheckedChanged(object sender, EventArgs e) { comboBoxProject.Enabled = checkBoxProject.Checked; labelProject.Enabled = checkBoxProject.Checked; if (checkBoxProject.Checked) { ListBoxPart lbPart = (ListBoxPart)SnipPagePart.Create(_part.Designer, SnipPartType.ListBox); lbPart.StyleType = StyleType.ProjectPageListPart; _listBoxPartsDic[StyleType.ProjectPageListPart] = lbPart; } else { _listBoxPartsDic.Remove(StyleType.ProjectPageListPart); } }
void SnipItem_MouseMove(object sender, MouseEventArgs e) { if (_snipItemIsMouseDown) { ///检查鼠标移动的位置有没有达到拖拽的最小值 int minDrawDropValue = 5; if ((Math.Abs(Control.MousePosition.X - _prevMouseLocation.X) > minDrawDropValue) || (Math.Abs(Control.MousePosition.Y - _prevMouseLocation.Y) > minDrawDropValue)) { TreeView _item = (TreeView)sender; MdiSnipDesignerForm _activeMdiForm = WorkbenchForm.MainForm.ActiveView as MdiSnipDesignerForm; SnipPagePart part = null; switch (_item.SelectedNode.Name) { case "_insertBoxItem": if (_activeMdiForm != null) { part = SnipPagePart.Create(_activeMdiForm.SnipPageDesigner, SnipPartType.Box); } break; case "_insertTextItem": if (_activeMdiForm != null) { part = SnipPagePart.Create(_activeMdiForm.SnipPageDesigner, SnipPartType.Static); } break; case "_insertListItem": if (_activeMdiForm != null) { part = SnipPagePart.Create(_activeMdiForm.SnipPageDesigner, SnipPartType.List); } break; case "_insertNavigationItem": if (_activeMdiForm != null) { //part = SnipPagePart.Create(_activeMdiForm.SnipPageDesigner, SnipPartType.NavigationBox); } break; case "_insertChannelItem": if (_activeMdiForm != null) { //part = SnipPagePart.Create(_activeMdiForm.SnipPageDesigner, SnipPartType.Navigation); } break; case "_insertPathItem": if (_activeMdiForm != null) { part = SnipPagePart.Create(_activeMdiForm.SnipPageDesigner, SnipPartType.Path); } break; default: break; } _snipItemIsMouseDown = false; if (part != null) { _activeMdiForm.SnipPageDesigner.StartPartDragDrop(part); _activeMdiForm.SnipPageDesigner.Capture = true; _activeMdiForm.Activate(); } } } }
static public SnipPagePart Parse(SnipPartXmlElement ele, SnipPageDesigner designer) { SnipPartType type = ele.SnipPartType; SnipPagePart part = null; switch (type) { case SnipPartType.Static: { part = SnipPagePart.Create(designer, type); ((StaticPart)part).PageText = ele.CDataValue; break; } case SnipPartType.Box: { part = SnipPagePart.Create(designer, type); break; } case SnipPartType.List: { ListPart listPart = (ListPart)SnipPagePart.Create(designer, SnipPartType.List); part = listPart; break; } case SnipPartType.ListBox: { ListBoxPart listBoxPart = (ListBoxPart)SnipPagePart.Create(designer, SnipPartType.ListBox); listBoxPart.StyleType = ele.StyleType; part = listBoxPart; break; } case SnipPartType.Navigation: { NavigationPart nPart = (NavigationPart)SnipPagePart.Create(designer, SnipPartType.Navigation); nPart.ChannelID = ele.GetAttribute("channelId"); nPart.Text = ele.CDataValue; part = nPart; break; } case SnipPartType.Attribute: { AttributePart attributepart = (AttributePart)SnipPagePart.Create(designer, SnipPartType.Attribute); attributepart.AttributeName = ele.AttributeName; attributepart.Text = ele.CDataValue; part = attributepart; break; } case SnipPartType.Path: { PathPart pathPart = (PathPart)SnipPagePart.Create(designer, SnipPartType.Path); pathPart.LinkDisplayType = (DisplayType)Enum.Parse(typeof(DisplayType), ele.GetAttribute("linkDisplayType")); pathPart.SeparatorCode = ele.GetAttribute("separatorCode"); part = pathPart; break; } default: throw new Exception("开发期异常。未知的SnipPartType:" + type); } part.PartType = type; part.Css = ele.SnipPartCss; part.PartID = ele.SnipPartId; part.CustomID = ele.CustomId; part.AElement = ele.AElement; return(part); }