Esempio n. 1
0
        private void InitializeComponent()
        {
            this.SuspendLayout();
            //
            // FrmQueueDate
            //
            //this.ClientSize = new System.Drawing.Size(284, 261);
            sB1 = new C1StatusBar();
            sB1.AutoSizeElement = C1.Framework.AutoSizeElement.Width;
            sB1.Location        = new System.Drawing.Point(0, 428);
            sB1.Name            = "c1StatusBar1";
            sB1.Size            = new System.Drawing.Size(800, 22);
            lbStatus            = new RibbonLabel();
            btnStatus           = new RibbonButton();
            sB1.Dock            = DockStyle.Bottom;
            sB1.LeftPaneItems.Add(lbStatus);
            sB1.RightPaneItems.Add(btnStatus);
            lbStatus.Text        = "";
            btnStatus.Text       = "config";
            btnStatus.SmallImage = Resources.setting1;

            pn1      = new Panel();
            pn1.Dock = DockStyle.Fill;
            //pn1.Height = this.Height - sB1.Height - 25;

            this.Controls.Add(pn1);
            this.Controls.Add(sB1);

            this.Name  = "FrmQueueDate";
            this.Load += new System.EventHandler(this.FrmQueueDate_Load);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Esempio n. 2
0
        private void initCompoment()
        {
            int  gapLine = 20, gapX = 20;
            Size size = new Size();
            int  scrW = Screen.PrimaryScreen.Bounds.Width;

            sb1      = new C1.Win.C1Ribbon.C1StatusBar();
            panel1   = new Panel();
            pnHead   = new Panel();
            pnBotton = new Panel();
            theme1   = new C1.Win.C1Themes.C1ThemeController();

            panel1.SuspendLayout();
            pnHead.SuspendLayout();
            pnBotton.SuspendLayout();

            panel1.Controls.Add(pnHead);
            panel1.Controls.Add(pnBotton);
            this.Controls.Add(panel1);
            this.Controls.Add(sb1);

            panel1.ResumeLayout(false);
            pnHead.ResumeLayout(false);
            pnBotton.ResumeLayout(false);
            panel1.PerformLayout();
            pnHead.PerformLayout();
            pnBotton.PerformLayout();
            this.PerformLayout();
        }
Esempio n. 3
0
        private void initConfig()
        {
            InitializeComponent();
            this.Size     = new System.Drawing.Size(1224, 768);
            fEdit         = new Font(bqc.iniC.grdViewFontName, bqc.grdViewFontSize, FontStyle.Regular);
            fEditPrintQue = new Font(bqc.iniC.printerQueueFontName, int.Parse(bqc.iniC.printerQueueFontSize), FontStyle.Regular);
            theme1        = new C1ThemeController();

            this.Text            = "Run-time Controls";
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.StartPosition   = FormStartPosition.CenterParent;
            //this.StartPosition = FormStartPosition.CenterParent;
            pn1      = new Panel();
            pn1.Dock = DockStyle.Fill;
            this.Controls.Add(pn1);

            sB1 = new C1StatusBar();
            sB1.AutoSizeElement = C1.Framework.AutoSizeElement.Width;
            sB1.Location        = new System.Drawing.Point(0, 428);
            sB1.Name            = "c1StatusBar1";
            sB1.Size            = new System.Drawing.Size(800, 22);
            lbStatus            = new RibbonLabel();
            btnStatus           = new RibbonButton();
            sB1.LeftPaneItems.Add(lbStatus);
            sB1.RightPaneItems.Add(btnStatus);
            lbStatus.Text        = "";
            btnStatus.Text       = "เพิ่มรายการ";
            btnStatus.SmallImage = Resources.setting1;
            btnStatus.Click     += BtnStatus_Click;

            this.Controls.Add(sB1);

            initGrfQueCaller();
            setGrfQueCaller();
            this.StartPosition = FormStartPosition.CenterScreen;
        }
Esempio n. 4
0
        private void initConfig()
        {
            pageLoad = true;
            fEdit    = new Font(bqc.iniC.grdQueFontName, bqc.grdQueFontSize, FontStyle.Regular);
            fEditB   = new Font(bqc.iniC.grdQueFontName, bqc.grdQueFontSize, FontStyle.Bold);
            theme1   = new C1ThemeController();
            InitializeComponent();

            pn1      = new Panel();
            pn1.Dock = DockStyle.Fill;
            this.Controls.Add(pn1);

            sB1 = new C1StatusBar();
            sB1.AutoSizeElement = C1.Framework.AutoSizeElement.Width;
            sB1.Location        = new System.Drawing.Point(0, 428);
            sB1.Name            = "c1StatusBar1";
            sB1.Size            = new System.Drawing.Size(800, 22);
            lbStatus            = new RibbonLabel();
            btnStatus           = new RibbonButton();
            sB1.LeftPaneItems.Add(lbStatus);
            sB1.RightPaneItems.Add(btnStatus);
            lbStatus.Text        = "";
            btnStatus.Text       = "config";
            btnStatus.SmallImage = Resources.setting1;
            btnStatus.Click     += BtnStatus_Click;
            this.Controls.Add(sB1);
            lbStatus.Text = "";
            theme1.SetTheme(sB1, "Office2016DarkGray");

            initGrfQue();
            setGrfQueue();
            this.WindowState = FormWindowState.Normal;
            //this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.StartPosition = FormStartPosition.CenterScreen;
            pageLoad           = false;
        }
        internal static int IndexOf(UIElementInfo info)
        {
            int    pos    = -1;
            object parent = info.Parent;

            // try to get the index of info.UIElement
            if (parent is RibbonGroup)
            {
                pos = ((RibbonGroup)parent).Items.IndexOf(info.UIElement as RibbonItem);
            }
            else if (parent is RibbonTab)
            {
                pos = ((RibbonTab)parent).Groups.IndexOf(info.UIElement as RibbonGroup);
            }
            else if (parent is RibbonDropDownBase)
            {
                if (parent is RibbonApplicationMenu)
                {
                    RibbonApplicationMenu appMenu = ((RibbonApplicationMenu)parent);
                    // RibbonApplicationMenu has three child collections,
                    // so we use index range from 0 to 999 for BottomPaneItems,
                    // index range from 1000 to 1999 for LeftPaneItems, and
                    // index range starting with 2000 for RightPaneItems
                    pos = appMenu.BottomPaneItems.IndexOf(info.UIElement as RibbonItem);
                    if (pos < 0)
                    {
                        pos = appMenu.LeftPaneItems.IndexOf(info.UIElement as RibbonItem);
                        if (pos >= 0)
                        {
                            pos += 1000;
                        }
                        else
                        {
                            pos = appMenu.RightPaneItems.IndexOf(info.UIElement as RibbonItem);
                            if (pos >= 0)
                            {
                                pos += 2000;
                            }
                        }
                    }
                }
                else if (parent is RibbonComboBox)
                {
                    pos = ((RibbonComboBox)parent).MenuItems.IndexOf(info.UIElement as RibbonItem);
                    if (pos < 0)
                    {
                        pos = ((RibbonComboBox)parent).Items.IndexOf(info.UIElement as RibbonItem);
                        if (pos >= 0)
                        {
                            pos += 1000;
                        }
                    }
                }
                else if (parent is RibbonGallery)
                {
                    pos = ((RibbonGallery)parent).MenuItems.IndexOf(info.UIElement as RibbonItem);
                    if (pos < 0)
                    {
                        pos = ((RibbonGallery)parent).Items.IndexOf(info.UIElement as RibbonItem);
                        if (pos >= 0)
                        {
                            pos += 1000;
                        }
                    }
                }
                else
                {
                    pos = ((RibbonDropDownBase)parent).Items.IndexOf(info.UIElement as RibbonItem);
                }
            }
            else if (parent is RibbonItemContainer)
            {
                pos = ((RibbonItemContainer)parent).Items.IndexOf(info.UIElement as RibbonItem);
                if (parent is RibbonQat && pos == -1)
                {
                    pos = ((RibbonQat)parent).MenuItems.IndexOf(info.UIElement as RibbonItem);
                    if (pos >= 0)
                    {
                        pos += 1000;
                    }
                }
            }
            else if (parent is RibbonListItem)
            {
                pos = ((RibbonListItem)parent).Items.IndexOf(info.UIElement as RibbonItem);
            }
            else if (parent is C1Ribbon)
            {
                C1Ribbon ribbon = (C1Ribbon)parent;
                if (ribbon.ApplicationMenu.Equals(info.UIElement))
                {
                    pos = 0;
                }
                else if (ribbon.ConfigToolBar.Equals(info.UIElement))
                {
                    pos = 1;
                }
                else if (ribbon.Qat.Equals(info.UIElement))
                {
                    pos = 2;
                }
                else
                {
                    pos = ribbon.Tabs.IndexOf(info.UIElement as RibbonTab);
                    if (pos >= 0)
                    {
                        pos += 1000;
                    }
                }
            }
            else if (parent is C1StatusBar)
            {
                C1StatusBar bar = (C1StatusBar)parent;
                pos = bar.LeftPaneItems.IndexOf(info.UIElement as RibbonItem);
                if (pos < 0)
                {
                    pos = bar.RightPaneItems.IndexOf(info.UIElement as RibbonItem);
                    if (pos >= 0)
                    {
                        pos += 1000;
                    }
                }
            }

            // if uiElement does not have an index, return -1
            if (pos < 0)
            {
                pos = -1;
            }
            return(pos);
        }
        internal static object FindUIElement(object parent, string name)
        {
            int pos;

            // Check if the name contains the UI element's index in the parent children collection instead of its real Name.
            // This way we handle UI elements whose Name property is not set.
            if (!int.TryParse(name, out pos))
            {
                pos = -1;
            }
            object child = null;

            try
            {
                // check the parent object type, whether we need to handle it
                if (parent is RibbonGroup)
                {
                    // if the name contains an index, try to get the child UI element by that index
                    if (pos != -1)
                    {
                        child = ((RibbonGroup)parent).Items[pos];
                    }
                    // otherwise, try to get the child UI element by its name
                    else
                    {
                        child = ((RibbonGroup)parent).Items[name];
                    }
                }
                else if (parent is RibbonTab)
                {
                    if (pos != -1)
                    {
                        child = ((RibbonTab)parent).Groups[pos];
                    }
                    else
                    {
                        child = ((RibbonTab)parent).Groups[name];
                    }
                }
                else if (parent is RibbonDropDownBase)
                {
                    if (parent is RibbonApplicationMenu)
                    {
                        RibbonApplicationMenu appMenu = ((RibbonApplicationMenu)parent);
                        if (pos != -1)
                        {
                            // RibbonApplicationMenu has three child collections,
                            // so we use index range from 0 to 999 for BottomPaneItems
                            if (pos < 1000)
                            {
                                child = appMenu.BottomPaneItems[pos];
                            }
                            // use index range from 1000 to 1999 for LeftPaneItems
                            else if (pos < 2000)
                            {
                                child = appMenu.LeftPaneItems[pos - 1000];
                            }
                            // use index range starting from 2000 for RightPaneItems
                            else
                            {
                                child = appMenu.RightPaneItems[pos - 2000];
                            }
                        }
                        else
                        {
                            // RibbonApplicationMenu has three child collections,
                            // so we look the child UI element up in all of them
                            if (appMenu.BottomPaneItems.Contains(name))
                            {
                                child = appMenu.BottomPaneItems[name];
                            }
                            else if (appMenu.LeftPaneItems.Contains(name))
                            {
                                child = appMenu.LeftPaneItems[name];
                            }
                            else
                            {
                                child = appMenu.RightPaneItems[name];
                            }
                        }
                    }
                    else if (parent is RibbonComboBox)
                    {
                        if (pos != -1)
                        {
                            // RibbonComboBox has two child collections,
                            // so we use index range from 0 to 999 for MenuItems
                            if (pos < 1000)
                            {
                                child = ((RibbonComboBox)parent).MenuItems[pos];
                            }
                            // use index range starting from 1000 for Items
                            else
                            {
                                child = ((RibbonComboBox)parent).Items[pos - 1000];
                            }
                        }
                    }
                    else if (parent is RibbonGallery)
                    {
                        if (pos != -1)
                        {
                            if (pos < 1000)
                            {
                                child = ((RibbonGallery)parent).MenuItems[pos];
                            }
                            else
                            {
                                child = ((RibbonGallery)parent).Items[pos - 1000];
                            }
                        }
                    }
                    else
                    {
                        if (pos != -1)
                        {
                            child = ((RibbonDropDownBase)parent).Items[pos];
                        }
                        else
                        {
                            child = ((RibbonDropDownBase)parent).Items[name];
                        }
                    }
                }
                else if (parent is RibbonItemContainer)
                {
                    if (pos != -1)
                    {
                        if (pos < 1000)
                        {
                            child = ((RibbonItemContainer)parent).Items[pos];
                        }
                        else
                        {
                            child = ((RibbonQat)parent).MenuItems[pos - 1000];
                        }
                    }
                    else
                    {
                        if (((RibbonItemContainer)parent).Items.Contains(name))
                        {
                            child = ((RibbonItemContainer)parent).Items[name];
                        }
                        else
                        {
                            child = ((RibbonQat)parent).MenuItems[name];
                        }
                    }
                }
                else if (parent is RibbonListItem)
                {
                    if (pos != -1)
                    {
                        child = ((RibbonListItem)parent).Items[pos];
                    }
                    else
                    {
                        child = ((RibbonListItem)parent).Items[name];
                    }
                }
                else if (parent is C1Ribbon)
                {
                    C1Ribbon ribbon = (C1Ribbon)parent;
                    if (pos != -1)
                    {
                        if (pos == 0)
                        {
                            child = ribbon.ApplicationMenu;
                        }
                        else if (pos == 1)
                        {
                            child = ribbon.ConfigToolBar;
                        }
                        else if (pos == 2)
                        {
                            child = ribbon.Qat;
                        }
                        else
                        {
                            child = ribbon.Tabs[pos - 1000];
                        }
                    }
                    else
                    {
                        child = ribbon.Tabs[name];
                    }
                }
                else if (parent is C1StatusBar)
                {
                    C1StatusBar bar = (C1StatusBar)parent;
                    if (pos != -1)
                    {
                        if (pos < 1000)
                        {
                            child = bar.LeftPaneItems[pos];
                        }
                        else
                        {
                            child = bar.RightPaneItems[pos - 1000];
                        }
                    }
                    else
                    {
                        child = bar.LeftPaneItems[name];
                        if (child == null)
                        {
                            child = bar.RightPaneItems[name];
                        }
                    }
                }
            }
            // an exception can occur if parent doesn't contain a child UI element with the specified name,
            // in that case we return null
            catch { }
            return(child);
        }