Example #1
0
        /// <summary>
        /// 获取调整尺寸的点
        /// </summary>
        /// <param name="mp">坐标</param>
        /// <returns>调整尺寸的点</returns>
        private int getResizePoint(FCPoint mp)
        {
            FCRect[] pRects = getResizePoints();
            int      rsize  = pRects.Length;

            for (int i = rsize - 1; i >= 0; i--)
            {
                FCRect rect = pRects[i];
                if (mp.x >= rect.left && mp.x <= rect.right &&
                    mp.y >= rect.top && mp.y <= rect.bottom)
                {
                    return(i);
                }
            }
            int targetsSize = m_targets.Count;

            if (targetsSize > 0)
            {
                int width = Width, height = Height;
                if (mp.x >= 0 && mp.x <= width && mp.y >= 0 && mp.y <= height)
                {
                    bool inBorder = false;
                    int  size     = RESIZEPOINT_SIZE;
                    if (mp.x <= size ||
                        mp.x >= width - size ||
                        mp.y <= size ||
                        mp.y >= height - size)
                    {
                        inBorder = true;
                    }
                    if (targetsSize == 1)
                    {
                        if (m_xml.isContainer(m_targets[0]))
                        {
                            if (inBorder)
                            {
                                return(8);
                            }
                        }
                        else
                        {
                            return(8);
                        }
                    }
                    else
                    {
                        if (inBorder)
                        {
                            return(8);
                        }
                    }
                }
            }
            return(-1);
        }
Example #2
0
 /// <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();
 }