Example #1
0
        /// <summary>
        /// 更新布局方法
        /// </summary>
        public override void update()
        {
            base.update();
            int width = Width, height = Height;
            int uBottom = 0;

            if (m_upButton != null)
            {
                int     uWidth   = m_upButton.Width;
                FCPoint location = new FCPoint(width - uWidth, 0);
                m_upButton.Location = location;
                FCSize size = new FCSize(uWidth, height / 2);
                m_upButton.Size = size;
                uBottom         = m_upButton.Bottom;
                FCPadding oldPadding = Padding;
                FCPadding padding    = new FCPadding(oldPadding.left, oldPadding.top, uWidth + 3, oldPadding.bottom);
                Padding = padding;
            }
            if (m_downButton != null)
            {
                int     dWidth   = m_downButton.Width;
                FCPoint location = new FCPoint(width - dWidth, uBottom);
                m_downButton.Location = location;
                FCSize size = new FCSize(dWidth, height - uBottom);
                m_downButton.Size = size;
            }
        }
Example #2
0
        /// <summary>
        /// 重置缩放尺寸
        /// </summary>
        /// <param name="clientSize">客户端大小</param>
        public void resetScaleSize(FCSize clientSize)
        {
            FCNative native = Native;

            if (native != null)
            {
                FCHost        host         = native.Host;
                FCSize        nativeSize   = native.DisplaySize;
                List <FCView> controls     = native.getControls();
                int           controlsSize = controls.Count;
                for (int i = 0; i < controlsSize; i++)
                {
                    FCWindowFrame frame = controls[i] as FCWindowFrame;
                    if (frame != null)
                    {
                        WindowEx window = frame.getControls()[0] as WindowEx;
                        if (window != null && !window.AnimateMoving)
                        {
                            FCPoint location = window.Location;
                            if (location.x < 10 || location.x > nativeSize.cx - 10)
                            {
                                location.x = 0;
                            }
                            if (location.y < 30 || location.y > nativeSize.cy - 30)
                            {
                                location.y = 0;
                            }
                            window.Location = location;
                        }
                    }
                }
                native.ScaleSize = new FCSize((int)(clientSize.cx * m_scaleFactor), (int)(clientSize.cy * m_scaleFactor));
                native.update();
            }
        }
Example #3
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintForeground(FCPaint paint, FCRect clipRect)
 {
     base.onPaintForeground(paint, clipRect);
     if (Native != null && m_grid != null)
     {
         FCRect rect      = new FCRect(0, 0, Width, Height);
         int    tLeft     = rect.right - 15;
         int    midTop    = rect.top + (rect.bottom - rect.top) / 2;
         long   textColor = getPaintingTextColor();
         //升序
         if (m_sortMode == FCGridColumnSortMode.Asc)
         {
             FCPoint[] points = new FCPoint[3]
             {
                 new FCPoint(tLeft + 5, midTop - 5),
                 new FCPoint(tLeft, midTop + 5),
                 new FCPoint(tLeft + 10, midTop + 5)
             };
             paint.fillPolygon(textColor, points);
         }
         //降序
         else if (m_sortMode == FCGridColumnSortMode.Desc)
         {
             FCPoint[] points = new FCPoint[3]
             {
                 new FCPoint(tLeft + 5, midTop + 5),
                 new FCPoint(tLeft, midTop - 5),
                 new FCPoint(tLeft + 10, midTop - 5)
             };
             paint.fillPolygon(textColor, points);
         }
     }
 }
Example #4
0
        /// <summary>
        /// 重绘背景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            int     width = Width, height = Height;
            FCPoint p1 = new FCPoint(), p2 = new FCPoint(), p3 = new FCPoint();

            //计算三个点的位置
            if (m_toLast)
            {
                p1.x = 0;
                p1.y = height / 2;
                p2.x = width;
                p2.y = 0;
                p3.x = width;
                p3.y = height;
            }
            else
            {
                p1.x = 0;
                p1.y = 0;
                p2.x = 0;
                p2.y = height;
                p3.x = width;
                p3.y = height / 2;
            }
            FCPoint[] points = new FCPoint[3];
            points[0] = p1;
            points[1] = p2;
            points[2] = p3;
            paint.fillPolygon(getPaintingTextColor(), points);
        }
Example #5
0
        /// <summary>
        /// 下拉菜单显示方法
        /// </summary>
        public virtual void onDropDownOpening()
        {
            //创建下拉菜单及日历
            if (m_dropDownMenu == null)
            {
                FCHost host = Native.Host;
                m_dropDownMenu = host.createInternalControl(this, "dropdownmenu") as FCMenu;
                Native.addControl(m_dropDownMenu);
                if (m_calendar == null)
                {
                    m_calendar = CreateCalendar();
                    m_dropDownMenu.addControl(m_calendar);
                    m_calendar.Size = m_dropDownMenu.Size;
                    m_calendar.addEvent(m_selectedTimeChangedEvent, FCEventID.SELECTEDTIMECHANGED);
                }
            }
            if (m_calendar != null && !m_showTime)
            {
                m_calendar.TimeDiv.Height = 0;
            }
            m_dropDownMenu.Native = Native;
            FCPoint nativePoint = pointToNative(new FCPoint(0, Height));

            m_dropDownMenu.Location = nativePoint;
            m_dropDownMenu.Visible  = true;
            if (m_calendar != null)
            {
                m_calendar.Mode = FCCalendarMode.Day;
            }
            m_dropDownMenu.bringToFront();
            m_dropDownMenu.invalidate();
        }
Example #6
0
 /// <summary>
 /// 按键抬起方法
 /// </summary>
 /// <param name="key">按键</param>
 public override void onKeyUp(char key)
 {
     if (!IsDragging)
     {
         m_step = 1;
         base.onKeyUp(key);
         if (m_offsetX != 0 || m_offsetY != 0)
         {
             int targetsSize = m_targets.Count;
             if (targetsSize > 0)
             {
                 m_designerDiv.saveUndo();
                 for (int i = 0; i < targetsSize; i++)
                 {
                     FCView  target      = m_targets[i];
                     FCPoint oldLocation = target.Location;
                     oldLocation.x += m_offsetX;
                     oldLocation.y += m_offsetY;
                     m_xml.setProperty(target, "location", FCStr.convertPointToStr(oldLocation));
                     target.update();
                 }
                 m_designerDiv.Designer.refreshProperties();
             }
             refreshStatusBar();
             Parent.invalidate();
         }
     }
     m_offsetX = 0;
     m_offsetY = 0;
 }
Example #7
0
        /// <summary>
        /// 布局改变方法
        /// </summary>
        public override void update()
        {
            base.update();
            int width = Width;

            if (m_closeButton != null)
            {
                FCPoint location = new FCPoint(width - 26, 2);
                m_closeButton.Location = location;
            }
            if (m_maxOrRestoreButton != null && m_maxOrRestoreButton.Visible)
            {
                FCPoint location = new FCPoint(width - 48, 2);
                m_maxOrRestoreButton.Location = location;
            }
            if (m_minButton != null && m_minButton.Visible)
            {
                FCPoint location = new FCPoint(width - 70, 2);
                if (m_maxOrRestoreButton != null && !m_maxOrRestoreButton.Visible)
                {
                    location.x = width - 48;
                }
                m_minButton.Location = location;
            }
        }
Example #8
0
 /// <summary>
 /// 触摸按下方法
 /// </summary>
 /// <param name="touchInfo">触摸信息</param>
 public override void onTouchDown(FCTouchInfo touchInfo)
 {
     base.onTouchDown(touchInfo);
     if (touchInfo.m_firstTouch && touchInfo.m_clicks == 1)
     {
         if (m_allowResize)
         {
             ArrayList <FCGridBand> bands = null;
             if (m_parentBand != null)
             {
                 bands = m_parentBand.getBands();
             }
             else
             {
                 bands = m_grid.getBands();
             }
             int bandsSize = bands.size();
             if (m_index > 0 && touchInfo.m_firstPoint.x < 5)
             {
                 m_resizeState = 1;
                 m_beginWidth  = bands[m_index - 1].Width;
             }
             else if ((m_parentBand == null || m_index < bandsSize - 1) && touchInfo.m_firstPoint.x > Width - 5)
             {
                 m_resizeState = 2;
                 m_beginWidth  = Width;
             }
             m_touchDownPoint = Native.TouchPoint;
         }
     }
 }
Example #9
0
        /// <summary>
        /// 自动适应位置和大小
        /// </summary>
        /// <param name="menu">菜单</param>
        protected void adjust(FCMenu menu)
        {
            FCNative native = Native;

            if (AutoSize)
            {
                int contentHeight = menu.getContentHeight();
                int maximumHeight = MaximumSize.cy;
                menu.Height = Math.Min(contentHeight, maximumHeight);
            }
            FCPoint mPoint = menu.Location;
            FCSize  mSize  = menu.Size;
            FCSize  nSize  = native.DisplaySize;

            if (mPoint.x < 0)
            {
                mPoint.x = 0;
            }
            if (mPoint.y < 0)
            {
                mPoint.y = 0;
            }
            if (mPoint.x + mSize.cx > nSize.cx)
            {
                mPoint.x = nSize.cx - mSize.cx;
            }
            if (mPoint.y + mSize.cy > nSize.cy)
            {
                mPoint.y = nSize.cy - mSize.cy;
            }
            menu.Location = mPoint;
            menu.update();
        }
Example #10
0
        /// <summary>
        /// 重绘边线方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBorder(FCPaint paint, FCRect clipRect)
        {
            FCFont font = Font;
            int    width = Width, height = Height;
            String text  = Text;
            FCSize tSize = new FCSize();

            if (text.Length > 0)
            {
                tSize = paint.textSize(text, font);
            }
            else
            {
                tSize    = paint.textSize("0", font);
                tSize.cx = 0;
            }
            //绘制边线
            FCPoint[] points  = new FCPoint[6];
            int       tMid    = tSize.cy / 2;
            int       padding = 2;

            points[0] = new FCPoint(10, tMid);
            points[1] = new FCPoint(padding, tMid);
            points[2] = new FCPoint(padding, height - padding);
            points[3] = new FCPoint(width - padding, height - padding);
            points[4] = new FCPoint(width - padding, tMid);
            points[5] = new FCPoint(14 + tSize.cx, tMid);
            paint.drawPolyline(getPaintingBorderColor(), 1, 0, points);
            callPaintEvents(FCEventID.PAINTBORDER, paint, clipRect);
        }
Example #11
0
        /// <summary>
        /// 触摸点击方法
        /// </summary>
        /// <param name="touchInfo">触摸信息</param>
        public void onClick(FCTouchInfo touchInfo)
        {
            FCPoint mp = touchInfo.m_firstPoint;
            int     monthButtonsSize = m_monthButtons.size();

            for (int i = 0; i < monthButtonsSize; i++)
            {
                MonthButton monthButton = m_monthButtons.get(i);
                if (monthButton.Visible)
                {
                    FCRect bounds = monthButton.Bounds;
                    if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom)
                    {
                        monthButton.onClick(touchInfo);
                        return;
                    }
                }
            }
            int monthButtonAmSize = m_monthButtons_am.size();

            for (int i = 0; i < monthButtonAmSize; i++)
            {
                MonthButton monthButton = m_monthButtons_am.get(i);
                if (monthButton.Visible)
                {
                    FCRect bounds = monthButton.Bounds;
                    if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom)
                    {
                        monthButton.onClick(touchInfo);
                        return;
                    }
                }
            }
        }
Example #12
0
 /// <summary>
 /// 秒表方法
 /// </summary>
 /// <param name="timerID">秒表ID</param>
 public override void onTimer(int timerID)
 {
     base.onTimer(timerID);
     if (m_timerID == timerID)
     {
         FCPoint mp = TouchPoint;
         if (!m_showAlways)
         {
             if (m_lastTouchPoint.x != mp.x || m_lastTouchPoint.y != mp.y)
             {
                 Visible = false;
             }
         }
         m_lastTouchPoint = mp;
         if (m_remainAutoPopDelay > 0)
         {
             m_remainAutoPopDelay -= 10;
             if (m_remainAutoPopDelay <= 0)
             {
                 Visible = false;
             }
         }
         if (m_remainInitialDelay > 0)
         {
             m_remainInitialDelay -= 10;
             if (m_remainInitialDelay <= 0)
             {
                 Visible = true;
             }
         }
     }
 }
Example #13
0
        /// <summary>
        /// 根据两个点获取矩形区域
        /// </summary>
        /// <param name="point1">坐标1</param>
        /// <param name="point2">坐标2</param>
        /// <returns>矩形区域</returns>
        public FCRect getRectangle(FCPoint point1, FCPoint point2)
        {
            int minX = Math.Min(point1.x, point2.x);
            int maxX = Math.Max(point1.x, point2.x);
            int minY = Math.Min(point1.y, point2.y);
            int maxY = Math.Max(point1.y, point2.y);

            return(new FCRect(minX, minY, maxX, maxY));
        }
Example #14
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            String text = Text;
            int    width = Width, height = Height;

            if (width > 0 && height > 0)
            {
                FCRect  buttonRect = new FCRect(5, (height - m_buttonSize.cy) / 2, 5 + m_buttonSize.cx, (height + m_buttonSize.cy) / 2);
                FCPoint tLocation  = new FCPoint();
                FCSize  tSize      = new FCSize();
                FCFont  font       = Font;
                if (text != null && text.Length > 0)
                {
                    tSize       = paint.textSize(text, font);
                    tLocation.x = buttonRect.right + 5;
                    tLocation.y = (height - tSize.cy) / 2;
                }
                //居中
                if (m_buttonAlign == FCHorizontalAlign.Center)
                {
                    buttonRect.left  = (width - m_buttonSize.cx) / 2;
                    buttonRect.right = (width + m_buttonSize.cx) / 2;
                    tLocation.x      = buttonRect.right + 5;
                }
                //远离
                else if (m_buttonAlign == FCHorizontalAlign.Right)
                {
                    buttonRect.left  = width - m_buttonSize.cx - 5;
                    buttonRect.right = width - 5;
                    tLocation.x      = buttonRect.left - tSize.cx - 5;
                }
                //绘制背景图
                onPaintCheckButton(paint, buttonRect);
                //绘制文字
                if (text != null && text.Length > 0)
                {
                    FCRect tRect     = new FCRect(tLocation.x, tLocation.y, tLocation.x + tSize.cx + 1, tLocation.y + tSize.cy);
                    long   textColor = getPaintingTextColor();
                    if (AutoEllipsis && (tRect.right > clipRect.right || tRect.bottom > clipRect.bottom))
                    {
                        if (tRect.right > clipRect.right)
                        {
                            tRect.right = clipRect.right;
                        }
                        if (tRect.bottom > clipRect.bottom)
                        {
                            tRect.bottom = clipRect.bottom;
                        }
                        paint.drawTextAutoEllipsis(text, textColor, font, tRect);
                    }
                    else
                    {
                        paint.drawText(text, textColor, font, tRect);
                    }
                }
            }
        }
Example #15
0
 /// <summary>
 /// 布局改变方法
 /// </summary>
 public override void update()
 {
     base.update();
     if (m_closeButton != null)
     {
         FCPoint location = new FCPoint(Width - 26, 2);
         m_closeButton.Location = location;
     }
 }
Example #16
0
 /// <summary>
 /// 显示提示框
 /// </summary>
 /// <param name="text">文字</param>
 /// <param name="mp">位置</param>
 public override void showToolTip(String text, FCPoint mp)
 {
     if (m_toolTip != null)
     {
         m_toolTip.Native   = m_native;
         m_toolTip.Location = mp;
         m_toolTip.Text     = text;
         m_toolTip.show();
     }
 }
Example #17
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 #18
0
        /// <summary>
        /// 单元格触摸抬起方法
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="touchInfo">触摸信息</param>
        public override void onCellTouchUp(FCGridCell cell, FCTouchInfo touchInfo)
        {
            base.onCellTouchUp(cell, touchInfo);
            FCPoint mp = touchInfo.m_firstPoint;

            if (m_movingNode != null)
            {
                FCGridRow curRow = getRow(mp);
                //移动
                if (curRow != null)
                {
                    FCTreeNode curNode = curRow.getCell(0) as FCTreeNode;
                    if (curNode.AllowDragIn && m_movingNode != curNode)
                    {
                        FCTreeNode curNodeParent    = curNode.Parent;
                        FCTreeNode movingNodeParent = m_movingNode.Parent;
                        if (movingNodeParent != null)
                        {
                            movingNodeParent.removeNode(m_movingNode);
                        }
                        else
                        {
                            removeNode(m_movingNode);
                        }
                        //有父节点
                        if (curNodeParent != null)
                        {
                            if (movingNodeParent == curNodeParent)
                            {
                                curNodeParent.insertNode(curNodeParent.getNodeIndex(curNode), m_movingNode);
                            }
                            else
                            {
                                curNode.appendNode(m_movingNode);
                            }
                        }
                        //无父节点
                        else
                        {
                            if (movingNodeParent == curNodeParent)
                            {
                                insertNode(getNodeIndex(curNode), m_movingNode);
                            }
                            else
                            {
                                curNode.appendNode(m_movingNode);
                            }
                        }
                        curNode.expend();
                    }
                }
                m_movingNode = null;
                update();
            }
        }
Example #19
0
        /// <summary>
        /// 单元格触摸按下方法
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="touchInfo">触摸信息</param>
        public override void onCellTouchDown(FCGridCell cell, FCTouchInfo touchInfo)
        {
            base.onCellTouchDown(cell, touchInfo);
            FCPoint    mp   = touchInfo.m_firstPoint;
            FCTreeNode node = cell as FCTreeNode;

            if (node != null)
            {
                int          scrollH    = 0;
                FCHScrollBar hscrollBar = HScrollBar;
                if (hscrollBar != null && hscrollBar.Visible)
                {
                    scrollH = hscrollBar.Pos;
                }
                FCRect headerRect = node.TargetColumn.Bounds;
                headerRect.left += HorizontalOffset - scrollH;
                headerRect.top  += VerticalOffset - scrollH;
                int left = headerRect.left;
                //复选框
                if (m_checkBoxes)
                {
                    int cw = m_checkBoxSize.cx;
                    if (mp.x >= left && mp.x <= left + cw)
                    {
                        node.Checked = !node.Checked;
                        return;
                    }
                    left += cw + 10;
                }
                //折叠节点
                ArrayList <FCTreeNode> childNodes = node.getChildNodes();
                if (childNodes != null && childNodes.size() > 0)
                {
                    int nw = m_nodeSize.cx;
                    if (mp.x >= left && mp.x <= left + nw)
                    {
                        if (node.Expended)
                        {
                            node.collapse();
                        }
                        else
                        {
                            node.expend();
                        }
                        update();
                        return;
                    }
                }
                //移动
                if (node.AllowDragOut)
                {
                    m_movingNode = node;
                }
            }
        }
Example #20
0
        /// <summary>
        /// 获取显示偏移坐标
        /// </summary>
        /// <returns>坐标</returns>
        public override FCPoint getDisplayOffset()
        {
            FCPoint offset = new FCPoint();

            if (Visible)
            {
                offset.x = (m_hScrollBar != null && m_hScrollBar.Visible) ? m_hScrollBar.Pos : 0;
                offset.y = (m_vScrollBar != null && m_vScrollBar.Visible) ? m_vScrollBar.Pos : 0;
            }
            return(offset);
        }
Example #21
0
        /// <summary>
        /// 获取偏移坐标
        /// </summary>
        /// <returns>偏移坐标</returns>
        public FCPoint getOffsetPoint()
        {
            FCPoint offset = new FCPoint();
            FCView  parent = Parent;

            if (parent != null)
            {
                FCTabPage designerDiv = parent as FCTabPage;
                offset.x += (designerDiv.HScrollBar != null ? designerDiv.HScrollBar.Pos : 0);
                offset.y += (designerDiv.VScrollBar != null ? designerDiv.VScrollBar.Pos : 0);
            }
            return(offset);
        }
Example #22
0
        /// <summary>
        /// 最小化
        /// </summary>
        public void min()
        {
            m_normalLocation           = Location;
            m_normalSize               = Size;
            Dock                       = FCDockStyle.None;
            m_windowState              = WindowStateA.Min;
            m_maxOrRestoreButton.Style = WindowButtonStyle.Restore;
            FCSize minSize = new FCSize(150, CaptionHeight);

            Size = minSize;
            update();
            Native.invalidate();
        }
Example #23
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintForeground(FCPaint paint, FCRect clipRect)
 {
     base.onPaintForeground(paint, clipRect);
     //绘制移动的节点
     if (m_movingNode != null)
     {
         FCFont  font  = Font;
         FCPoint mp    = TouchPoint;
         FCSize  tSize = paint.textSize(m_movingNode.Text, font);
         FCRect  tRect = new FCRect(mp.x, mp.y, mp.x + tSize.cx, mp.y + tSize.cy);
         paint.drawText(m_movingNode.Text, TextColor, font, tRect);
     }
 }
Example #24
0
        /// <summary>
        /// 获取鼠标按键
        /// </summary>
        /// <param name="var">变量</param>
        /// <returns>状态</returns>
        public int GETMOUSEPOINT(CVariable var)
        {
            FCPoint   touchPoint = m_xml.Event.TouchInfo.m_firstPoint;
            CVariable newVar     = new CVariable(m_indicator);

            newVar.m_expression = touchPoint.x.ToString();
            m_indicator.setVariable(var.m_parameters[0], newVar);
            CVariable newVar2 = new CVariable(m_indicator);

            newVar2.m_expression = touchPoint.y.ToString();
            m_indicator.setVariable(var.m_parameters[1], newVar2);
            return(1);
        }
Example #25
0
 /// <summary>
 /// 控件项鼠标移动事件
 /// </summary>
 /// <param name="sender">调用者</param>
 /// <param name="mp">坐标</param>
 /// <param name="button">按钮</param>
 /// <param name="clicks">点击次数</param>
 /// <param name="delta">滚轮值</param>
 private void toolBoxItemTouchMove(object sender, FCTouchInfo touchInto)
 {
     if (m_dragingItem.Visible)
     {
         FCView  control  = sender as FCView;
         FCPoint mp       = touchInto.m_firstPoint;
         FCPoint location = control.pointToNative(mp);
         location.x            += 10;
         location.y            -= 16;
         m_dragingItem.Location = location;
         Native.invalidate();
     }
 }
Example #26
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 #27
0
 /// <summary>
 /// 菜单下拉方法
 /// </summary>
 public virtual void onDropDownOpening()
 {
     if (m_dropDownMenu != null)
     {
         m_dropDownMenu.Native = Native;
         FCPoint nativePoint = pointToNative(new FCPoint(0, Height));
         m_dropDownMenu.Location = nativePoint;
         m_dropDownMenu.Size     = new FCSize(Width, m_dropDownMenu.getContentHeight());
         m_dropDownMenu.Width    = Width;
         m_dropDownMenu.Visible  = true;
         m_dropDownMenu.bringToFront();
         m_dropDownMenu.invalidate();
     }
 }
Example #28
0
        /// <summary>
        /// 拖动滚动开始
        /// </summary>
        public virtual void onDragScrollStart()
        {
            m_isDragScrolling  = false;
            m_isDragScrolling2 = false;
            FCView focusedControl = Native.FocusedControl;

            if (m_hScrollBar != null && m_hScrollBar.Visible)
            {
                if (focusedControl == m_hScrollBar.AddButton ||
                    focusedControl == m_hScrollBar.ReduceButton ||
                    focusedControl == m_hScrollBar.BackButton ||
                    focusedControl == m_hScrollBar.ScrollButton)
                {
                    m_hScrollBar.AddSpeed = 0;
                    return;
                }
            }
            if (m_vScrollBar != null && m_vScrollBar.Visible)
            {
                if (focusedControl == m_vScrollBar.AddButton ||
                    focusedControl == m_vScrollBar.ReduceButton ||
                    focusedControl == m_vScrollBar.BackButton ||
                    focusedControl == m_vScrollBar.ScrollButton)
                {
                    m_vScrollBar.AddSpeed = 0;
                    return;
                }
            }
            if (m_allowDragScroll)
            {
                if (m_hScrollBar != null && m_hScrollBar.Visible)
                {
                    m_startMovePosX       = m_hScrollBar.Pos;
                    m_hScrollBar.AddSpeed = 0;
                    m_readyToDragScroll   = true;
                }
                if (m_vScrollBar != null && m_vScrollBar.Visible)
                {
                    m_startMovePosY       = m_vScrollBar.Pos;
                    m_vScrollBar.AddSpeed = 0;
                    m_readyToDragScroll   = true;
                }
                if (m_readyToDragScroll)
                {
                    m_startMovePoint = Native.TouchPoint;
                    m_startMoveTime  = DateTime.Now;
                }
            }
        }
Example #29
0
        /// <summary>
        /// 滚动开始方法
        /// </summary>
        /// <returns>是否已处理</returns>
        public override bool onDragBegin()
        {
            FCPoint mp = TouchPoint;
            int     width = Width, height = Height;

            if (mp.y > m_captionHeight)
            {
                return(false);
            }
            if (m_resizePoint != -1)
            {
                return(false);
            }
            return(base.onDragBegin());
        }
Example #30
0
        /// <summary>
        /// 获取文本
        /// </summary>
        /// <returns>文本</returns>
        public static String getText()
        {
            FCPoint mp = new FCPoint();

            GetCursorPos(ref mp);
            IntPtr handle = WindowFromPoint(mp.x, mp.y);

            if (handle != IntPtr.Zero)
            {
                StringBuilder sb = new StringBuilder(10240);
                SendMessage((int)handle, 0xD, 10240, sb);
                return(sb.ToString());
            }
            return("");
        }