Example #1
0
        /// <summary>
        /// 注册事件
        /// </summary>
        /// <param name="control">控件</param>
        private void registerEvents(FCView control)
        {
            FCTouchEvent  clickButtonEvent = new FCTouchEvent(clickButton);
            List <FCView> controls         = control.getControls();
            int           controlsSize     = controls.Count;

            for (int i = 0; i < controlsSize; i++)
            {
                FCView   subControl = controls[i];
                FCButton button     = subControl as FCButton;
                FCGrid   grid       = subControl as FCGrid;
                if (button != null)
                {
                    button.addEvent(clickButtonEvent, FCEventID.CLICK);
                }
                else if (grid != null)
                {
                    FCGridRowStyle rowStyle = new FCGridRowStyle();
                    grid.RowStyle              = rowStyle;
                    rowStyle.BackColor         = FCColor.None;
                    rowStyle.SelectedBackColor = FCDraw.FCCOLORS_SELECTEDROWCOLOR;
                    rowStyle.HoveredBackColor  = FCDraw.FCCOLORS_HOVEREDROWCOLOR;
                    rowStyle.SelectedTextColor = FCDraw.FCCOLORS_TEXTCOLOR4;
                }
                registerEvents(subControl);
            }
        }
Example #2
0
        /// <summary>
        /// 控件添加方法
        /// </summary>
        public override void onLoad()
        {
            base.onLoad();
            //添加按钮
            FCHost host = Native.Host;

            if (m_addButton == null)
            {
                m_addButton = host.createInternalControl(this, "addbutton") as FCButton;
                m_addButton.addEvent(m_addButtonTouchDownEvent, FCEventID.TOUCHDOWN);
                m_addButton.addEvent(m_addButtonTouchUpEvent, FCEventID.TOUCHUP);
                addControl(m_addButton);
            }
            if (m_backButton == null)
            {
                m_backButton = host.createInternalControl(this, "backbutton") as FCButton;
                addControl(m_backButton);
            }
            if (m_reduceButton == null)
            {
                m_reduceButton = host.createInternalControl(this, "reducebutton") as FCButton;
                m_reduceButton.addEvent(m_reduceButtonTouchDownEvent, FCEventID.TOUCHDOWN);
                m_reduceButton.addEvent(m_reduceButtonTouchUpEvent, FCEventID.TOUCHUP);
                addControl(m_reduceButton);
            }
            if (m_scrollButton == null)
            {
                m_scrollButton           = host.createInternalControl(this, "scrollbutton") as FCButton;
                m_scrollButton.AllowDrag = true;
                m_scrollButton.addEvent(m_scrollButtonDraggingEvent, FCEventID.DRAGGING);
                m_backButton.addControl(m_scrollButton);
            }
        }
Example #3
0
        /// <summary>
        /// 显示方法
        /// </summary>
        public override void showDialog()
        {
            base.showDialog();
            FCButton btnOK     = getButton("btnOK");
            FCButton btnCancel = getButton("btnCancel");
            FCLabel  lblDelete = getLabel("lblDelete");

            if (m_isEdit)
            {
                FCTextBox txtName   = getTextBox("txtName");
                FCTextBox txtScript = getTextBox("txtScript");
                txtName.Text      = m_indicatorData.m_name;
                txtScript.Text    = m_indicatorData.m_script;
                txtName.Enabled   = false;
                lblDelete.Visible = true;
                btnOK.Text        = "修改";
                m_window.Text     = "修改指标";
            }
            else
            {
                lblDelete.Visible = false;
                btnOK.Text        = "新增";
                m_window.Height  -= 50;
            }
            Native.invalidate();
        }
Example #4
0
        /// <summary>
        /// 创建按钮控件单元格
        /// </summary>
        public FCGridButtonCell()
        {
            FCButton button = new FCButton();

            button.BorderColor   = FCColor.None;
            button.DisplayOffset = false;
            Control = button;
        }
Example #5
0
 /// <summary>
 /// 添加控件方法
 /// </summary>
 public override void onLoad()
 {
     base.onLoad();
     if (m_splitter == null)
     {
         FCHost host = Native.Host;
         m_splitter = host.createInternalControl(this, "splitter") as FCButton;
         m_splitter.addEvent(m_splitterDraggingEvent, FCEventID.DRAGGING);
         addControl(m_splitter);
     }
     m_oldSize = Size;
 }
Example #6
0
        /// <summary>
        /// 重新布局方法
        /// </summary>
        public override void update()
        {
            if (Native == null)
            {
                return;
            }
            FCButton addButton = AddButton;
            FCButton backButton = BackButton;
            FCButton reduceButton = ReduceButton;
            FCButton scrollButton = ScrollButton;
            int      width = Width, height = Height;
            int      contentSize = ContentSize;

            //设置按钮的位置
            if (contentSize > 0 && addButton != null && backButton != null && reduceButton != null && scrollButton != null)
            {
                int pos      = Pos;
                int pageSize = PageSize;
                if (pos > contentSize - pageSize)
                {
                    pos = contentSize - pageSize;
                }
                if (pos < 0)
                {
                    pos = 0;
                }
                int abWidth = addButton.Visible ? addButton.Width : 0;
                addButton.Size     = new FCSize(abWidth, height);
                addButton.Location = new FCPoint(width - abWidth, 0);
                int rbWidth = reduceButton.Visible ? reduceButton.Width : 0;
                reduceButton.Size     = new FCSize(rbWidth, height);
                reduceButton.Location = new FCPoint(0, 0);
                int backWidth = width - abWidth - rbWidth;
                backButton.Size     = new FCSize(backWidth, height);
                backButton.Location = new FCPoint(rbWidth, 0);
                //获取滚动条宽度和坐标
                int scrollWidth = backWidth * pageSize / contentSize;
                int scrollPos   = backWidth * pos / contentSize;
                if (scrollWidth < 10)
                {
                    scrollWidth = 10;
                    if (scrollPos + scrollWidth > backWidth)
                    {
                        scrollPos = backWidth - scrollWidth;
                    }
                }

                scrollButton.Size     = new FCSize(scrollWidth, height);
                scrollButton.Location = new FCPoint(scrollPos, 0);
            }
        }
Example #7
0
        /// <summary>
        /// 重新布局方法
        /// </summary>
        public override void update()
        {
            if (Native == null)
            {
                return;
            }
            FCButton addButton = AddButton;
            FCButton backButton = BackButton;
            FCButton reduceButton = ReduceButton;
            FCButton scrollButton = ScrollButton;
            int      width = Width, height = Height;
            int      contentSize = ContentSize;

            //设置按钮的位置
            if (contentSize > 0 && addButton != null && backButton != null && reduceButton != null && scrollButton != null)
            {
                int pos      = Pos;
                int pageSize = PageSize;
                if (pos > contentSize - pageSize)
                {
                    pos = contentSize - pageSize;
                }
                if (pos < 0)
                {
                    pos = 0;
                }
                int abHeight = addButton.Visible ? addButton.Height : 0;
                addButton.Size     = new FCSize(width, abHeight);
                addButton.Location = new FCPoint(0, height - abHeight);
                int rbHeight = reduceButton.Visible ? reduceButton.Height : 0;
                reduceButton.Size     = new FCSize(width, rbHeight);
                reduceButton.Location = new FCPoint(0, 0);
                int backHeight = height - abHeight - rbHeight;
                backButton.Size     = new FCSize(width, backHeight);
                backButton.Location = new FCPoint(0, rbHeight);
                //获取滚动条宽度和坐标
                int scrollHeight = backHeight * pageSize / contentSize;
                int scrollPos    = (int)((long)backHeight * (long)pos / contentSize);
                if (scrollHeight < 10)
                {
                    scrollHeight = 10;
                    if (scrollPos + scrollHeight > backHeight)
                    {
                        scrollPos = backHeight - scrollHeight;
                    }
                }
                scrollButton.Size     = new FCSize(width, scrollHeight);
                scrollButton.Location = new FCPoint(0, scrollPos);
            }
        }
Example #8
0
 /// <summary>
 /// 添加控件方法
 /// </summary>
 public override void onLoad()
 {
     base.onLoad();
     if (m_dropDownButton == null)
     {
         FCHost host = Native.Host;
         m_dropDownButton = host.createInternalControl(this, "dropdownbutton") as FCButton;
         addControl(m_dropDownButton);
         m_dropDownButton.addEvent(m_dropDownButtonTouchDownEvent, FCEventID.TOUCHDOWN);
     }
     if (m_dropDownMenu != null)
     {
         m_dropDownMenu.Native = Native;
     }
 }
Example #9
0
        /// <summary>
        /// 滚动条背景按钮触摸按下回调方法
        /// </summary>
        /// <param name="touchInfo">触摸信息</param>
        public void onBackButtonTouchDown(FCTouchInfo touchInfo)
        {
            FCButton scrollButton = ScrollButton;
            FCPoint  mp           = touchInfo.m_firstPoint;

            if (mp.x < scrollButton.Left)
            {
                pageReduce();
                IsReducing = true;
            }
            else if (mp.x > scrollButton.Right)
            {
                pageAdd();
                IsAdding = true;
            }
        }
Example #10
0
        /// <summary>
        /// 滚动条背景按钮触摸按下回调方法
        /// </summary>
        /// <param name="touchInfo">触摸信息</param>
        public void onBackButtonTouchDown(FCTouchInfo touchInfo)
        {
            FCButton scrollButton = ScrollButton;
            FCPoint  mp           = touchInfo.m_firstPoint;

            if (mp.y < scrollButton.Top)
            {
                pageReduce();
                IsReducing = true;
            }
            else if (mp.y > scrollButton.Bottom)
            {
                pageAdd();
                IsAdding = true;
            }
        }
Example #11
0
        /// <summary>
        /// 注册事件
        /// </summary>
        /// <param name="control">控件</param>
        private void registerEvents(FCView control)
        {
            FCTouchEvent  clickButtonEvent = new FCTouchEvent(clickButton);
            List <FCView> controls         = control.getControls();
            int           controlsSize     = controls.Count;

            for (int i = 0; i < controlsSize; i++)
            {
                FCButton button = controls[i] as FCButton;
                if (button != null)
                {
                    button.addEvent(clickButtonEvent, FCEventID.CLICK);
                }
                registerEvents(controls[i]);
            }
        }
Example #12
0
        /// <summary>
        /// 添加控件方法
        /// </summary>
        public override void onLoad()
        {
            bool     isAdd      = false;
            FCButton backButton = BackButton;

            if (backButton != null)
            {
                isAdd = true;
            }
            base.onLoad();
            if (!isAdd)
            {
                backButton = BackButton;
                backButton.addEvent(m_backButtonTouchDownEvent, FCEventID.TOUCHDOWN);
                backButton.addEvent(m_backButtonTouchUpEvent, FCEventID.TOUCHUP);
            }
        }
Example #13
0
 /// <summary>
 /// 添加控件方法
 /// </summary>
 public override void onLoad()
 {
     base.onLoad();
     if (m_tabControl != null)
     {
         if (m_headerButton == null)
         {
             FCHost host = Native.Host;
             m_headerButton = host.createInternalControl(this, "headerbutton") as FCButton;
             m_headerButton.addEvent(m_dragHeaderBeginEvent, FCEventID.DRAGBEGIN);
             m_headerButton.addEvent(m_dragHeaderEndEvent, FCEventID.DRAGEND);
             m_headerButton.addEvent(m_draggingHeaderEvent, FCEventID.DRAGGING);
             m_headerButton.addEvent(m_headerTouchDownEvent, FCEventID.TOUCHDOWN);
         }
         if (!m_tabControl.containsControl(m_headerButton))
         {
             m_tabControl.addControl(m_headerButton);
         }
     }
 }
Example #14
0
 /// <summary>
 /// 销毁方法
 /// </summary>
 public override void delete()
 {
     if (!IsDeleted)
     {
         FCButton backButton = BackButton;
         if (backButton != null)
         {
             if (m_backButtonTouchDownEvent != null)
             {
                 backButton.removeEvent(m_backButtonTouchDownEvent, FCEventID.TOUCHDOWN);
                 m_backButtonTouchDownEvent = null;
             }
             if (m_backButtonTouchUpEvent != null)
             {
                 backButton.removeEvent(m_backButtonTouchUpEvent, FCEventID.TOUCHUP);
                 m_backButtonTouchUpEvent = null;
             }
         }
     }
     base.delete();
 }
Example #15
0
        /// <summary>
        /// 添加控件方法
        /// </summary>
        public override void onLoad()
        {
            base.onLoad();
            FCHost host = Native.Host;

            if (m_downButton == null)
            {
                m_downButton = host.createInternalControl(this, "downbutton") as FCButton;
                m_downButton.addEvent(m_downButtoTouchDownEvent, FCEventID.TOUCHDOWN);
                m_downButton.addEvent(m_downButtoTouchUpEvent, FCEventID.TOUCHUP);
                addControl(m_downButton);
            }
            if (m_upButton == null)
            {
                m_upButton = host.createInternalControl(this, "upbutton") as FCButton;
                m_upButton.addEvent(m_upButtonTouchDownEvent, FCEventID.TOUCHDOWN);
                m_upButton.addEvent(m_upButtonTouchUpEvent, FCEventID.TOUCHUP);
                addControl(m_upButton);
            }
            update();
        }
Example #16
0
 /// <summary>
 /// 销毁方法
 /// </summary>
 public override void delete()
 {
     if (!IsDeleted)
     {
         if (m_dragHeaderBeginEvent != null)
         {
             if (m_headerButton != null)
             {
                 m_headerButton.removeEvent(m_dragHeaderBeginEvent, FCEventID.DRAGBEGIN);
             }
             m_dragHeaderBeginEvent = null;
         }
         if (m_dragHeaderEndEvent != null)
         {
             if (m_headerButton != null)
             {
                 m_headerButton.removeEvent(m_dragHeaderEndEvent, FCEventID.DRAGEND);
             }
             m_dragHeaderEndEvent = null;
         }
         if (m_draggingHeaderEvent != null)
         {
             if (m_headerButton != null)
             {
                 m_headerButton.removeEvent(m_draggingHeaderEvent, FCEventID.DRAGGING);
             }
             m_draggingHeaderEvent = null;
         }
         if (m_headerTouchDownEvent != null)
         {
             if (m_headerButton != null)
             {
                 m_headerButton.removeEvent(m_headerTouchDownEvent, FCEventID.TOUCHDOWN);
             }
             m_headerTouchDownEvent = null;
         }
         m_headerButton = null;
     }
     base.delete();
 }
Example #17
0
        /// <summary>
        /// 拖动滚动方法
        /// </summary>
        public override void onDragScroll()
        {
            bool     floatRight       = false;
            FCButton backButton       = BackButton;
            FCButton scrollButton     = ScrollButton;
            int      backButtonHeight = backButton.Height;
            int      contentSize      = ContentSize;

            if (scrollButton.Bottom > backButtonHeight)
            {
                floatRight = true;
            }
            base.onDragScroll();
            if (floatRight)
            {
                Pos = contentSize;
            }
            else
            {
                Pos = (int)(((long)contentSize * (long)scrollButton.Top) / backButton.Height);
            }
            onScrolled();
        }
Example #18
0
        /// <summary>
        /// 拖动滚动方法
        /// </summary>
        public override void onDragScroll()
        {
            bool     floatRight      = false;
            FCButton backButton      = BackButton;
            FCButton scrollButton    = ScrollButton;
            int      backButtonWidth = backButton.Width;
            int      contentSize     = ContentSize;

            if (scrollButton.Right > backButtonWidth)
            {
                floatRight = true;
            }
            base.onDragScroll();
            if (floatRight)
            {
                Pos = contentSize;
            }
            else
            {
                Pos = (int)((long)contentSize * (long)scrollButton.Left / backButtonWidth);
            }
            onScrolled();
        }
Example #19
0
        /// <summary>
        /// 添加控件方法
        /// </summary>
        public override void onLoad()
        {
            base.onLoad();
            FCHost host = Native.Host;

            if (m_dropDownButton == null)
            {
                m_dropDownButton = host.createInternalControl(this, "dropdownbutton") as FCButton;
                addControl(m_dropDownButton);
                m_dropDownButton.addEvent(m_dropDownButtonTouchDownEvent, FCEventID.TOUCHDOWN);
            }
            if (m_dropDownMenu == null)
            {
                m_dropDownMenu = host.createInternalControl(this, "dropdownmenu") as FCComboBoxMenu;
                Native.addControl(m_dropDownMenu);
                m_dropDownMenu.Visible = false;
                m_dropDownMenu.addEvent(m_menuItemClickEvent, FCEventID.MENUITEMCLICK);
                m_dropDownMenu.addEvent(m_menuKeyDownEvent, FCEventID.KEYDOWN);
            }
            else
            {
                m_dropDownMenu.Native = Native;
            }
        }
Example #20
0
        /// <summary>
        /// 重新布局
        /// </summary>
        public override void update()
        {
            if (Native == null)
            {
                return;
            }
            base.update();
            FCPadding padding = Padding;
            int       left = padding.left, top = padding.top;
            int       width       = Width - padding.left - padding.right;
            int       height      = Height - padding.top - padding.bottom;
            int       tabPageSize = m_tabPages.size();

            for (int i = 0; i < tabPageSize; i++)
            {
                FCTabPage tabPage      = m_tabPages.get(i);
                FCButton  headerButton = tabPage.HeaderButton;
                if (headerButton.Visible)
                {
                    FCPadding margin         = headerButton.Margin;
                    int       tw             = headerButton.Width + margin.left + margin.right;
                    int       th             = headerButton.Height + margin.top + margin.bottom;
                    FCRect    bounds         = new FCRect();
                    FCPoint   headerLocation = new FCPoint();
                    int       layout         = 0;
                    switch (m_layout)
                    {
                    case FCTabPageLayout.Bottom:
                        layout = 0;
                        break;

                    case FCTabPageLayout.Left:
                        layout = 1;
                        break;

                    case FCTabPageLayout.Right:
                        layout = 2;
                        break;

                    case FCTabPageLayout.Top:
                        layout = 3;
                        break;
                    }
                    tabStyle(layout, ref bounds, ref padding,
                             ref margin, left, top, width, height,
                             tw, th, ref headerLocation);
                    tabPage.Bounds         = bounds;
                    tabPage.HeaderLocation = headerLocation;
                    if (!m_useAnimation)
                    {
                        tabPage.HeaderButton.Location = headerLocation;
                    }
                    if (m_animationState > 0)
                    {
                        if (m_layout == FCTabPageLayout.Left || m_layout == FCTabPageLayout.Right)
                        {
                            headerLocation.y = headerButton.Top;
                        }
                        else if (m_layout == FCTabPageLayout.Bottom || m_layout == FCTabPageLayout.Top)
                        {
                            headerLocation.x = headerButton.Left;
                        }
                    }
                    headerButton.Location = headerLocation;
                    left += tw;
                    top  += th;
                }
                else
                {
                    tabPage.Visible = false;
                }
            }
        }
Example #21
0
        /// <summary>
        /// 页头拖动中
        /// </summary>
        /// <param name="tabPage">页</param>
        public virtual void onDraggingTabHeader(FCTabPage tabPage)
        {
            FCButton headerButton = tabPage.HeaderButton;
            int      moving       = headerButton.Left;

            if (m_layout == FCTabPageLayout.Left || m_layout == FCTabPageLayout.Right)
            {
                moving = headerButton.Top;
            }
            int tabPageSize = m_tabPages.size();

            for (int i = 0; i < tabPageSize; i++)
            {
                FCTabPage page = m_tabPages.get(i);
                if (page != tabPage)
                {
                    FCButton tpHeader = page.HeaderButton;
                    if (tpHeader.Visible)
                    {
                        int pos   = page.HeaderLocation.x;
                        int size  = tpHeader.Width;
                        int sSize = headerButton.Width;
                        if (m_layout == FCTabPageLayout.Left || m_layout == FCTabPageLayout.Right)
                        {
                            pos   = page.HeaderLocation.y;
                            size  = tpHeader.Height;
                            sSize = headerButton.Height;
                        }
                        bool instead = false;
                        //向左交换
                        if (moving > pos)
                        {
                            if (moving > pos &&
                                moving < pos + size / 2)
                            {
                                instead = true;
                            }
                        }
                        if (moving < pos)
                        {
                            if (moving + sSize > pos + size / 2 &&
                                moving + sSize < pos + size)
                            {
                                instead = true;
                            }
                        }
                        //向右交换
                        if (instead)
                        {
                            FCPoint sLocation = tabPage.HeaderLocation;
                            if (m_layout == FCTabPageLayout.Left || m_layout == FCTabPageLayout.Right)
                            {
                                tabPage.HeaderLocation = new FCPoint(tabPage.HeaderLocation.x, pos);
                                page.HeaderLocation    = new FCPoint(page.HeaderLocation.x, sLocation.y);
                            }
                            else
                            {
                                tabPage.HeaderLocation = new FCPoint(pos, tabPage.HeaderLocation.y);
                                page.HeaderLocation    = new FCPoint(sLocation.x, page.HeaderLocation.y);
                            }
                            int oIndex = m_tabPages.IndexOf(tabPage);
                            int nIndex = m_tabPages.IndexOf(page);
                            m_tabPages.set(oIndex, page);
                            m_tabPages.set(nIndex, tabPage);
                            m_selectedIndex = nIndex;
                            break;
                        }
                    }
                }
            }
            drawMoving();
        }
Example #22
0
 /// <summary>
 /// 绘制移动
 /// </summary>
 protected void drawMoving()
 {
     if (m_animationState > 0)
     {
         bool      drawing         = false;
         int       tabPageSize     = m_tabPages.size();
         FCTabPage selectedTabPage = SelectedTabPage;
         for (int i = 0; i < tabPageSize; i++)
         {
             FCTabPage tabPage = m_tabPages.get(i);
             if (tabPage == selectedTabPage && m_animationState == 1)
             {
                 continue;
             }
             FCButton headerButton = tabPage.HeaderButton;
             if (headerButton.Visible)
             {
                 int moving = headerButton.Left;
                 int pos    = tabPage.HeaderLocation.x;
                 if (m_layout == FCTabPageLayout.Left || m_layout == FCTabPageLayout.Right)
                 {
                     pos    = tabPage.HeaderLocation.y;
                     moving = headerButton.Top;
                 }
                 if (pos != moving)
                 {
                     int relative = moving;
                     int sub      = Math.Abs(pos - relative);
                     int step     = 20;
                     if (m_useAnimation)
                     {
                         if (tabPage == selectedTabPage)
                         {
                             if (sub > 200)
                             {
                                 step = sub / 200 * 100;
                             }
                         }
                         else
                         {
                             step = sub;
                         }
                     }
                     else
                     {
                         step = sub;
                     }
                     if (relative != pos)
                     {
                         if (pos > relative + step)
                         {
                             relative += step;
                         }
                         else if (pos < relative - step)
                         {
                             relative -= step;
                         }
                         else
                         {
                             relative = pos;
                         }
                         if (m_layout == FCTabPageLayout.Left || m_layout == FCTabPageLayout.Right)
                         {
                             headerButton.Top = relative;
                         }
                         else
                         {
                             headerButton.Left = relative;
                         }
                         drawing = true;
                     }
                 }
             }
         }
         //绘制
         if (!drawing)
         {
             if (m_animationState == 2)
             {
                 m_animationState = 0;
             }
         }
         update();
         invalidate();
     }
 }
Example #23
0
        /// <summary>
        /// 创建内部控件
        /// </summary>
        /// <param name="parent">父控件</param>
        /// <param name="clsid">控件标识</param>
        /// <returns>内部控件</returns>
        public override FCView createInternalControl(FCView parent, String clsid)
        {
            //日历控件
            FCCalendar calendar = parent as FCCalendar;

            if (calendar != null)
            {
                if (clsid == "datetitle")
                {
                    return(new DateTitle(calendar));
                }
                else if (clsid == "headdiv")
                {
                    HeadDiv headDiv = new HeadDiv(calendar);
                    headDiv.Width = parent.Width;
                    headDiv.Dock  = FCDockStyle.Top;
                    return(headDiv);
                }
                else if (clsid == "lastbutton")
                {
                    return(new ArrowButton(calendar));
                }
                else if (clsid == "nextbutton")
                {
                    ArrowButton nextBtn = new ArrowButton(calendar);
                    nextBtn.ToLast = false;
                    return(nextBtn);
                }
            }
            //分割层
            FCSplitLayoutDiv splitLayoutDiv = parent as FCSplitLayoutDiv;

            if (splitLayoutDiv != null)
            {
                if (clsid == "splitter")
                {
                    FCButton splitter = new FCButton();
                    splitter.BackColor   = FCColor.Border;
                    splitter.BorderColor = FCColor.Border;
                    splitter.Size        = new FCSize(5, 5);
                    return(splitter);
                }
            }
            //滚动条
            FCScrollBar scrollBar = parent as FCScrollBar;

            if (scrollBar != null)
            {
                scrollBar.BorderColor = FCColor.None;
                scrollBar.BackColor   = FCColor.None;
                if (clsid == "addbutton")
                {
                    RibbonButton addButton = new RibbonButton();
                    addButton.Size = new FCSize(10, 10);
                    if (scrollBar is FCHScrollBar)
                    {
                        addButton.ArrowType = 2;
                    }
                    else if (scrollBar is FCVScrollBar)
                    {
                        addButton.ArrowType = 4;
                    }
                    return(addButton);
                }
                else if (clsid == "backbutton")
                {
                    FCButton backButton = new FCButton();
                    backButton.BorderColor = FCColor.None;
                    backButton.BackColor   = FCColor.None;
                    return(backButton);
                }
                else if (clsid == "scrollbutton")
                {
                    RibbonButton scrollButton = new RibbonButton();
                    scrollButton.AllowDrag = true;
                    if (scrollBar is FCVScrollBar)
                    {
                        scrollButton.Angle = 0;
                    }
                    return(scrollButton);
                }
                else if (clsid == "reducebutton")
                {
                    RibbonButton reduceButton = new RibbonButton();
                    reduceButton.Size = new FCSize(10, 10);
                    if (scrollBar is FCHScrollBar)
                    {
                        reduceButton.ArrowType = 1;
                    }
                    else if (scrollBar is FCVScrollBar)
                    {
                        reduceButton.ArrowType = 3;
                    }
                    return(reduceButton);
                }
            }
            //页夹
            FCTabPage tabPage = parent as FCTabPage;

            if (tabPage != null)
            {
                if (clsid == "headerbutton")
                {
                    RibbonButton button = new RibbonButton();
                    button.AllowDrag = true;
                    FCSize size = new FCSize(100, 20);
                    button.Size = size;
                    return(button);
                }
            }
            //下拉列表
            FCComboBox comboBox = parent as FCComboBox;

            if (comboBox != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int     width    = comboBox.Width;
                    int     height   = comboBox.Height;
                    FCPoint location = new FCPoint(width - 20, 0);
                    dropDownButton.Location = location;
                    FCSize size = new FCSize(20, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    FCComboBoxMenu comboBoxMenu = new FCComboBoxMenu();
                    comboBoxMenu.ComboBox = comboBox;
                    comboBoxMenu.Popup    = true;
                    FCSize size = new FCSize(100, 200);
                    comboBoxMenu.Size = size;
                    return(comboBoxMenu);
                }
            }
            //日期选择
            FCDateTimePicker datePicker = parent as FCDateTimePicker;

            if (datePicker != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int     width    = datePicker.Width;
                    int     height   = datePicker.Height;
                    FCPoint location = new FCPoint(width - 16, 0);
                    dropDownButton.Location = location;
                    FCSize size = new FCSize(16, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    FCMenu dropDownMenu = new FCMenu();
                    dropDownMenu.Padding = new FCPadding(1);
                    dropDownMenu.Popup   = true;
                    FCSize size = new FCSize(200, 200);
                    dropDownMenu.Size = size;
                    return(dropDownMenu);
                }
            }
            //数字选择
            FCSpin spin = parent as FCSpin;

            if (spin != null)
            {
                if (clsid == "downbutton")
                {
                    RibbonButton downButton = new RibbonButton();
                    downButton.DisplayOffset = false;
                    downButton.ArrowType     = 4;
                    FCSize size = new FCSize(16, 16);
                    downButton.Size = size;
                    return(downButton);
                }
                else if (clsid == "upbutton")
                {
                    RibbonButton upButton = new RibbonButton();
                    upButton.DisplayOffset = false;
                    upButton.ArrowType     = 3;
                    FCSize size = new FCSize(16, 16);
                    upButton.Size = size;
                    return(upButton);
                }
            }
            //容器层
            FCDiv div = parent as FCDiv;

            if (div != null)
            {
                if (clsid == "hscrollbar")
                {
                    FCHScrollBar hScrollBar = new FCHScrollBar();
                    hScrollBar.Visible = false;
                    hScrollBar.Size    = new FCSize(10, 10);
                    return(hScrollBar);
                }
                else if (clsid == "vscrollbar")
                {
                    FCVScrollBar vScrollBar = new FCVScrollBar();
                    vScrollBar.Visible = false;
                    vScrollBar.Size    = new FCSize(10, 10);
                    return(vScrollBar);
                }
            }
            //表格
            FCGrid grid = parent as FCGrid;

            if (grid != null)
            {
                if (clsid == "edittextbox")
                {
                    return(new FCTextBox());
                }
            }
            return(base.createInternalControl(parent, clsid));
        }
Example #24
0
        /// <summary>
        /// 单元格点击事件
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="mp">坐标</param>
        /// <param name="button">按钮</param>
        /// <param name="clicks">点击次数</param>
        /// <param name="delta">滚轮值</param>
        public override void onCellClick(FCGridCell cell, FCTouchInfo touchInto)
        {
            base.onCellClick(cell, touchInto);
            List <FCGridRow> rows = m_rows;
            int rowsSize          = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                FCGridRow         row   = rows[i];
                List <FCGridCell> cells = row.getCells();
                int cellsSize           = cells.Count;
                for (int j = 0; j < cellsSize; j++)
                {
                    FCGridControlCell cCell = cells[j] as FCGridControlCell;
                    if (cCell != null)
                    {
                        if (row == cell.Row)
                        {
                            cCell.Control.TextColor = FCDraw.FCCOLORS_TEXTCOLOR4;
                        }
                        else
                        {
                            cCell.Control.TextColor = FCColor.Text;
                        }
                    }
                }
            }
            if (touchInto.m_firstTouch)
            {
                if (touchInto.m_clicks == 1)
                {
                    if (!cell.AllowEdit && cell is GridColorCell)
                    {
                        GridColorCell colorCell   = cell as GridColorCell;
                        ColorDialog   colorDialog = new ColorDialog();
                        colorDialog.AllowFullOpen  = true;
                        colorDialog.AnyColor       = true;
                        colorDialog.SolidColorOnly = false;
                        int a = 0, r = 0, g = 0, b = 0;
                        FCColor.toArgb(Native.Paint, FCStr.convertStrToColor(colorCell.getString()), ref a, ref r, ref g, ref b);
                        colorDialog.Color = Color.FromArgb(a, r, g, b);
                        if (colorDialog.ShowDialog() == DialogResult.OK)
                        {
                            Color newColor = colorDialog.Color;
                            a = newColor.A;
                            r = newColor.R;
                            g = newColor.G;
                            b = newColor.B;
                            colorCell.setString(FCStr.convertColorToStr(FCColor.argb(a, r, g, b)));
                            FCGridCell nameCell = cell.Row.getCell("PROPERTYNAME");
                            if (nameCell != null)
                            {
                                m_designerDiv.saveUndo();
                                String name        = nameCell.Name;
                                String value       = cell.Text;
                                int    targetsSize = m_targets.Count;
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    FCView target = m_targets[i];
                                    m_xml.setProperty(target, name, value);
                                    if (m_collectionWindow != null)
                                    {
                                        m_collectionWindow.onPropertyChanged(name, value);
                                    }
                                    target.update();
                                }
                                //恢复正确的值
                                String rightValue = "", type = "";
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    m_targets[i].getProperty(name.ToLower(), ref rightValue, ref type);
                                }
                                cell.Text = rightValue;
                                Native.update();
                                Native.invalidate();
                            }
                        }
                        colorDialog.Dispose();
                    }
                    //字体单元格
                    else if (!cell.AllowEdit && cell is GridFontCell)
                    {
                        GridFontCell fontCell   = cell as GridFontCell;
                        FontDialog   fontDialog = new FontDialog();
                        fontDialog.Font = getFont(FCStr.convertStrToFont(fontCell.getString()));
                        if (fontDialog.ShowDialog() == DialogResult.OK)
                        {
                            Font newFont = fontDialog.Font;
                            fontCell.setString(FCStr.convertFontToStr(new FCFont(newFont.Name, newFont.Size, newFont.Bold, newFont.Underline, newFont.Italic, newFont.Strikeout)));
                            FCGridCell nameCell = cell.Row.getCell("PROPERTYNAME");
                            if (nameCell != null)
                            {
                                m_designerDiv.saveUndo();
                                String name        = nameCell.Name;
                                String value       = cell.Text;
                                int    targetsSize = m_targets.Count;
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    FCView target = m_targets[i];
                                    m_xml.setProperty(target, name, value);
                                    if (m_collectionWindow != null)
                                    {
                                        m_collectionWindow.onPropertyChanged(name, value);
                                    }
                                    target.update();
                                }
                                //恢复正确的值
                                String rightValue = "", type = "";
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    m_targets[i].getProperty(name.ToLower(), ref rightValue, ref type);
                                }
                                cell.Text = rightValue;
                                Native.update();
                                Native.invalidate();
                            }
                        }
                    }
                    //单击编辑框
                    else if (cell is FCGridButtonCell)
                    {
                        FCButton cButton = (cell as FCGridButtonCell).Button;
                        if (cButton.Tag != null)
                        {
                            String collectionName = cButton.Tag.ToString();
                            int    targetsSize    = m_targets.Count;
                            if (targetsSize > 0)
                            {
                                FCView           target           = m_targets[0];
                                CollectionWindow collectionWindow = new CollectionWindow(m_native);
                                collectionWindow.CollectionName = collectionName;
                                collectionWindow.DesignerDiv    = m_designerDiv;
                                collectionWindow.Target         = target;
                                collectionWindow.Xml            = m_xml;
                                collectionWindow.IsWinForm      = false;
                                collectionWindow.showDialog();
                            }
                        }
                    }
                }
            }
        }