/// <summary> /// 拖动结束方法 /// </summary> public override void onDragEnd() { base.onDragEnd(); int targetsSize = m_targets.Count; FCView divDesigner = Parent; //判定区域 FCNative native = Native; m_designerDiv.saveUndo(); FCPoint mp = Native.TouchPoint; for (int i = 0; i < targetsSize; i++) { FCView target = m_targets[i]; FCView parent = target.Parent; bool outControl = false; FCPoint oldNativeLocation = target.pointToNative(new FCPoint(0, 0)); if (parent != null) { if (divDesigner != null) { //查找新的控件 m_acceptTouch = false; FCView newParent = native.findControl(mp, divDesigner); m_acceptTouch = true; if (newParent != null && m_xml.isContainer(newParent) && newParent != this && newParent != parent && target != newParent) { //移除控件 m_xml.removeControl(target); //添加控件 m_xml.addControl(target, newParent); parent = newParent; outControl = true; } } } if (outControl || canDragTargets()) { FCRect newRect = convertBoundsToPRect(Bounds); oldNativeLocation.x += newRect.left - m_startRect.left; oldNativeLocation.y += newRect.top - m_startRect.top; m_xml.setProperty(target, "location", FCStr.convertPointToStr(target.Parent.pointToControl(oldNativeLocation))); target.update(); } } m_designerDiv.Designer.refreshProperties(); refreshStatusBar(); divDesigner.update(); }
/// <summary> /// 删除类 /// </summary> public void deleteClass() { List <FCGridRow> selectedRows = m_tvCollection.SelectedRows; int selectedRowsSize = selectedRows.Count; if (selectedRowsSize > 0) { if (m_collectionName == "TabPages") { FCTabControl tabControl = m_target as FCTabControl; FCTabPage tabPage = selectedRows[0].Tag as FCTabPage; m_xml.removeControl(tabPage); m_tvCollection.removeRow(selectedRows[0]); m_tvCollection.update(); tabControl.update(); } else if (m_collectionName == "Columns") { FCGrid grid = m_target as FCGrid; FCGridColumn column = selectedRows[0].Tag as FCGridColumn; grid.removeColumn(column); m_xml.m_controls.Remove(column); m_xml.Nodes[column].ParentNode.RemoveChild(m_xml.Nodes[column]); m_xml.Nodes.Remove(column); m_tvCollection.removeRow(selectedRows[0]); m_tvCollection.update(); grid.update(); } Native.invalidate(); m_designerDiv.saveUndo(); } }
/// <summary> /// 粘贴 /// </summary> public void paste() { if (m_sourceCodeTabPage.Visible) { m_scintilla.Clipboard.Paste(); } else { int copysSize = m_copys.Count; if (copysSize > 0) { UIXmlEx targetXml = Xml; FCPoint mp = m_native.TouchPoint; //查找控件 List <FCView> targets = m_resizeDiv.getTargets(); int targetsSize = targets.Count; if (targetsSize > 0) { FCView targetControl = targets[0]; if (!targetXml.isContainer(targetControl)) { targetControl = targetControl.Parent; } if (targetControl != null && targetXml.containsControl(targetControl)) { for (int i = 0; i < copysSize; i++) { FCView control = m_copys[i]; if (m_xml.containsControl(control)) { targetXml.copyControl(UITemplate.CreateControlName(control, m_xml), control, targetControl); if (m_isCut) { m_xml.removeControl(control); } break; } } } } } } m_isCut = false; m_copys.Clear(); m_native.invalidate(); }
/// <summary> /// 删除 /// </summary> public void del() { m_isCut = true; if (m_designerTabPage.Visible) { m_copys.Clear(); UIXmlEx xml = m_resizeDiv.Xml; List <FCView> targets = m_resizeDiv.getTargets(); int targetsSize = targets.Count; for (int i = 0; i < targetsSize; i++) { xml.removeControl(targets[i]); } m_resizeDiv.clearTargets(); m_resizeDiv.Visible = false; m_native.invalidate(); } }