コード例 #1
0
        /// <summary>
        /// 更新编辑器
        /// </summary>
        /// <param name="parent">控件</param>
        private void updateScintilla()
        {
            FCNative native = m_parentDiv.Native;

            if (native != null)
            {
                if (m_parentDiv.isPaintVisible(m_parentDiv))
                {
                    ShowWindow(Handle, SW_SHOWNOACTIVATE);
                    float     scaleFactorX = 1, scaleFactorY = 1;
                    FCSize    scaleSize = native.ScaleSize;
                    WinHostEx winHost   = native.Host as WinHostEx;
                    Control   control   = Control.FromHandle(winHost.HWnd);
                    FCSize    size      = new FCSize(control.ClientSize.Width, control.ClientSize.Height);
                    if (size.cx > 0 & size.cy > 0)
                    {
                        scaleFactorX = (float)scaleSize.cx / size.cx;
                        scaleFactorY = (float)scaleSize.cy / size.cy;
                    }
                    int x  = (int)(native.clientX(m_parentDiv) / scaleFactorX);
                    int y  = (int)(native.clientY(m_parentDiv) / scaleFactorY);
                    int cx = (int)(m_parentDiv.Width / scaleFactorX);
                    int cy = (int)(m_parentDiv.Height / scaleFactorY);
                    MoveWindow(Handle, x, y, cx, cy, true);
                }
                else
                {
                    ShowWindow(Handle, SW_HIDE);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取编辑页偏移
        /// </summary>
        /// <returns>坐标</returns>
        public FCPoint getDesignerOffset()
        {
            FCNative native  = Native;
            int      clientX = native.clientX(m_designerTabPage);
            int      clientY = native.clientY(m_designerTabPage);

            clientX -= (m_designerTabPage.HScrollBar != null ? m_designerTabPage.HScrollBar.Pos : 0);
            clientY -= (m_designerTabPage.VScrollBar != null ? m_designerTabPage.VScrollBar.Pos : 0);
            return(new FCPoint(clientX, clientY));
        }
コード例 #3
0
        /// <summary>
        /// 菜单触摸移动方法
        /// </summary>
        /// <param name="item">菜单项</param>
        /// <param name="touchInfo">触摸信息</param>
        public virtual void onMenuItemTouchMove(FCMenuItem item, FCTouchInfo touchInfo)
        {
            FCNative native = Native;
            ArrayList <FCMenuItem> items      = null;
            FCMenuItem             parentItem = item.ParentItem;

            if (parentItem != null)
            {
                items = parentItem.getItems();
            }
            else
            {
                items = m_items;
            }
            //关闭其他表格
            bool close = closeMenus(items);

            if (item.getItems().size() > 0)
            {
                FCMenu dropDownMenu = item.DropDownMenu;
                //获取位置和大小
                if (dropDownMenu != null)
                {
                    dropDownMenu.Native = native;
                    FCLayoutStyle layoutStyle = LayoutStyle;
                    FCPoint       location    = new FCPoint(native.clientX(item) + item.Width, native.clientY(item));
                    if (layoutStyle == FCLayoutStyle.LeftToRight || layoutStyle == FCLayoutStyle.RightToLeft)
                    {
                        location.x = native.clientX(item);
                        location.y = native.clientY(item) + item.Height;
                    }
                    //设置弹出位置
                    dropDownMenu.Opacity  = Opacity;
                    dropDownMenu.Location = location;
                    dropDownMenu.bringToFront();
                    dropDownMenu.focus();
                    dropDownMenu.show();
                    adjust(dropDownMenu);
                }
            }
            native.invalidate();
        }
コード例 #4
0
        /// <summary>
        /// 显示右键菜单
        /// </summary>
        /// <param name="var">变量</param>
        /// <returns>状态</returns>
        private double SHOWRIGHTMENU(CVariable var)
        {
            DesignerScript designerScript = m_xml.Script as DesignerScript;
            FCNative       native         = m_xml.Native;
            FCView         control        = m_xml.findControl(designerScript.getSender());
            int            clientX        = native.clientX(control);
            int            clientY        = native.clientY(control);
            FCMenu         menu           = m_xml.getMenu(m_indicator.getText(var.m_parameters[0]));

            menu.Location = new FCPoint(clientX, clientY + control.Height);
            menu.Visible  = true;
            menu.Focused  = true;
            menu.bringToFront();
            native.invalidate();
            return(0);
        }
コード例 #5
0
        /// <summary>
        /// 是否正在调整尺寸
        /// </summary>
        /// <param name="mp">坐标</param>
        /// <returns>正在调整尺寸</returns>
        public bool isResizing(FCPoint mp)
        {
            FCNative native = Native;
            int      clientX = native.clientX(this);
            int      clientY = native.clientY(this);
            int      width = Width, height = Height;

            if (mp.x >= clientX && mp.x <= clientX + width && mp.y >= clientY && mp.y <= clientY + height)
            {
                mp.x -= clientX;
                mp.y -= clientY;
                if (getResizePoint(TouchPoint) != -1)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #6
0
 /// <summary>
 /// 拖动中方法
 /// </summary>
 public override void onDragging()
 {
     base.onDragging();
     if (m_grid != null)
     {
         ArrayList <FCGridColumn> columns = m_grid.getColumns();
         int columnSize = columns.size();
         for (int i = 0; i < columnSize; i++)
         {
             FCGridColumn column = columns.get(i);
             if (column == this)
             {
                 FCGridColumn lastColumn = null;
                 FCGridColumn nextColumn = null;
                 int          lastIndex  = i - 1;
                 int          nextIndex  = i + 1;
                 while (lastIndex >= 0)
                 {
                     FCGridColumn thatColumn = columns.get(lastIndex);
                     if (thatColumn.Visible)
                     {
                         lastColumn = thatColumn;
                         break;
                     }
                     else
                     {
                         lastIndex--;
                     }
                 }
                 while (nextIndex < columnSize)
                 {
                     FCGridColumn thatColumn = columns.get(nextIndex);
                     if (thatColumn.Visible)
                     {
                         nextColumn = thatColumn;
                         break;
                     }
                     else
                     {
                         nextIndex++;
                     }
                 }
                 //交换列
                 FCNative native  = Native;
                 int      clientX = native.clientX(this);
                 if (lastColumn != null)
                 {
                     int lastClientX = native.clientX(lastColumn);
                     if (clientX < lastClientX + lastColumn.Width / 2)
                     {
                         columns.set(lastIndex, this);
                         columns.set(i, lastColumn);
                         m_grid.update();
                         break;
                     }
                 }
                 if (nextColumn != null)
                 {
                     int nextClientX = native.clientX(nextColumn);
                     if (clientX + column.Width > nextClientX + nextColumn.Width / 2)
                     {
                         columns.set(nextIndex, this);
                         columns.set(i, nextColumn);
                         m_grid.update();
                         break;
                     }
                 }
                 break;
             }
         }
     }
 }