示例#1
0
 /// <summary>
 /// 创建按钮
 /// </summary>
 /// <param name="calendar"></param>
 public DayButtonEx(CalendarA calendar) : base(calendar)
 {
 }
示例#2
0
        /// <summary>
        /// 创建内部控件
        /// </summary>
        /// <param name="parent">父控件</param>
        /// <param name="clsid">控件标识</param>
        /// <returns>内部控件</returns>
        public override ControlA CreateInternalControl(ControlA parent, String clsid)
        {
            //日历控件
            CalendarA calendar = parent as CalendarA;

            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  = DockStyleA.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);
                }
            }
            //分割层
            SplitLayoutDivA splitLayoutDiv = parent as SplitLayoutDivA;

            if (splitLayoutDiv != null)
            {
                if (clsid == "splitter")
                {
                    ButtonA splitter = new ButtonA();
                    splitter.BackColor = CDraw.PCOLORS_BACKCOLOR;
                    splitter.Size      = new SIZE(5, 5);
                    return(splitter);
                }
            }
            //滚动条
            ScrollBarA scrollBar = parent as ScrollBarA;

            if (scrollBar != null)
            {
                scrollBar.BackColor = COLOR.EMPTY;
                if (clsid == "addbutton")
                {
                    RibbonButton addButton = new RibbonButton();
                    addButton.Size = new SIZE(15, 15);
                    if (scrollBar is HScrollBarA)
                    {
                        addButton.ArrowType = 2;
                    }
                    else if (scrollBar is VScrollBarA)
                    {
                        addButton.ArrowType = 4;
                    }
                    return(addButton);
                }
                else if (clsid == "backbutton")
                {
                    ButtonA backButton = new ButtonA();
                    return(backButton);
                }
                else if (clsid == "scrollbutton")
                {
                    ButtonA scrollButton = new ButtonA();
                    scrollButton.AllowDrag   = true;
                    scrollButton.BackColor   = CDraw.PCOLORS_BACKCOLOR;
                    scrollButton.BorderColor = CDraw.PCOLORS_LINECOLOR3;
                    return(scrollButton);
                }
                else if (clsid == "reducebutton")
                {
                    RibbonButton reduceButton = new RibbonButton();
                    reduceButton.Size = new SIZE(15, 15);
                    if (scrollBar is HScrollBarA)
                    {
                        reduceButton.ArrowType = 1;
                    }
                    else if (scrollBar is VScrollBarA)
                    {
                        reduceButton.ArrowType = 3;
                    }
                    return(reduceButton);
                }
            }
            //页夹
            TabPageA tabPage = parent as TabPageA;

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

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

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

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

            if (div != null)
            {
                if (clsid == "hscrollbar")
                {
                    HScrollBarA hScrollBar = new HScrollBarA();
                    hScrollBar.Visible = false;
                    hScrollBar.Size    = new SIZE(15, 15);
                    return(hScrollBar);
                }
                else if (clsid == "vscrollbar")
                {
                    VScrollBarA vScrollBar = new VScrollBarA();
                    vScrollBar.Visible = false;
                    vScrollBar.Size    = new SIZE(15, 15);
                    return(vScrollBar);
                }
            }
            //表格
            GridA grid = parent as GridA;

            if (grid != null)
            {
                if (clsid == "edittextbox")
                {
                    TextBoxA textBox = new TextBoxA();
                    textBox.BackColor = CDraw.PCOLORS_BACKCOLOR;
                    return(textBox);
                }
            }
            return(null);
        }