Example #1
0
        /// <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();
        }
Example #2
0
 /// <summary>
 /// 复选框状态切换事件
 /// </summary>
 /// <param name="sender">调用者</param>
 private void checkBoxCheckedChanged(object sender)
 {
     if (m_xml != null)
     {
         if (!m_settingProperty)
         {
             m_settingProperty = true;
             FCCheckBox checkBox = sender as FCCheckBox;
             if (checkBox != null)
             {
                 m_designerDiv.saveUndo();
                 String name        = checkBox.Tag.ToString();
                 String value       = checkBox.Checked ? "True" : "False";
                 int    targetsSize = m_targets.Count;
                 for (int i = 0; i < targetsSize; i++)
                 {
                     FCView target = m_targets[i];
                     m_xml.setProperty(target, name, value);
                     target.update();
                 }
                 Native.update();
                 Native.invalidate();
             }
             m_settingProperty = false;
         }
     }
 }
Example #3
0
        /// <summary>
        /// 清除目标
        /// </summary>
        public void clearTargets()
        {
            //保存上次编辑的控件属性
            FCTextBox editTextBox = EditTextBox;

            if (editTextBox != null)
            {
                if (editTextBox.Tag != null)
                {
                    FCGridCell editingCell = EditTextBox.Tag as FCGridCell;
                    if (editingCell != null)
                    {
                        FCGridCell nameCell = editingCell.Row.getCell("PROPERTYNAME");
                        if (nameCell != null)
                        {
                            String cellName    = nameCell.Name;
                            String cellValue   = editTextBox.Text;
                            String eventName   = "on" + cellName.ToLower();
                            int    targetsSize = m_targets.Count;
                            for (int i = 0; i < targetsSize; i++)
                            {
                                FCView target = m_targets[i];
                                if (cellValue == null || cellValue.Trim().Length == 0)
                                {
                                    m_xml.removeProperty(target, eventName);
                                }
                                else
                                {
                                    m_xml.setProperty(target, eventName, cellValue);
                                }
                                target.update();
                            }
                        }
                    }
                }
                editTextBox.Visible = false;
            }
            m_targets.Clear();
        }