Exemplo n.º 1
0
        private void CreateRawFishTab()
        {
            this.c1Ribbon1.Tabs.Clear();
            Ribbon.RibbonTab homeTab = new Ribbon.RibbonTab("Raw Fish");
            Ribbon.RibbonGroup clipboardGroup = new Ribbon.RibbonGroup("Supply");
            Ribbon.RibbonButton pasteButton = new Ribbon.RibbonButton("New Trip", null, Properties.Resources.paste);
            pasteButton.TextImageRelation = Ribbon.TextImageRelation.ImageAboveText;

            Ribbon.RibbonButton ownerButton = new Ribbon.RibbonButton("Owners", null, Properties.Resources.paste);
            ownerButton.TextImageRelation = Ribbon.TextImageRelation.ImageAboveText;

            Ribbon.RibbonMenu vesselButton = new Ribbon.RibbonMenu();
            vesselButton.Text = "Vessels";
            vesselButton.Name = "Vessels";
            vesselButton.LargeImage = Properties.Resources.paste;
            vesselButton.Items.Add("US Vessel");
            vesselButton.Items.Add("California Vessel");
            vesselButton.TextImageRelation = Ribbon.TextImageRelation.Automatic;

            clipboardGroup.Items.Add(pasteButton);
            clipboardGroup.Items.Add(ownerButton);
            clipboardGroup.Items.Add(vesselButton);
            homeTab.Groups.Add(clipboardGroup);

            Ribbon.RibbonGroup receiptGroup = new Ribbon.RibbonGroup("Receipts");
            Ribbon.RibbonButton receiptButton = new Ribbon.RibbonButton("New Receipt", null);
            receiptButton.TextImageRelation = Ribbon.TextImageRelation.ImageAboveText;
            receiptGroup.Items.Add(receiptButton);
            homeTab.Groups.Add(receiptGroup);

            this.c1Ribbon1.Tabs.Add(homeTab);
        }
Exemplo n.º 2
0
 private void CreateColdStorageTab()
 {
     //this.c1Ribbon1.Tabs.Clear();
     Ribbon.RibbonTab homeTab = new Ribbon.RibbonTab("ColdStore");
     Ribbon.RibbonGroup clipboardGroup = new Ribbon.RibbonGroup("Supply");
     Ribbon.RibbonButton pasteButton = new Ribbon.RibbonButton("New Trip Code", null);
     pasteButton.TextImageRelation = Ribbon.TextImageRelation.ImageAboveText;
     clipboardGroup.Items.Add(pasteButton);
     homeTab.Groups.Add(clipboardGroup);
     this.c1Ribbon1.Tabs.Add(homeTab);
 }
        internal static UIElementInfo ResolveControl(object uiElement)
        {
            // initialize UIElementInfo object with the uiElement
            C1.Win.C1DynamicHelp.UIElementInfo info = new C1.Win.C1DynamicHelp.UIElementInfo(uiElement);
            // check the parent object type whether we need to handle it
            if (uiElement is C1.Win.C1Ribbon.RibbonTab)
            {
                C1.Win.C1Ribbon.RibbonTab tab = (C1.Win.C1Ribbon.RibbonTab)uiElement;
                // set the Name and Parent properties for the UIElementInfo object
                info.Name   = tab.ID;
                info.Parent = tab.Ribbon;
            }
            else if (uiElement is C1.Win.C1Ribbon.RibbonGroup)
            {
                C1.Win.C1Ribbon.RibbonGroup grp = (C1.Win.C1Ribbon.RibbonGroup)uiElement;
                // set the Name and Parent properties for the UIElementInfo object
                info.Name   = grp.ID;
                info.Parent = (grp.Tab != null) ? grp.Tab : (object)grp.Ribbon;
            }
            else if (uiElement is C1.Win.C1Ribbon.RibbonItem)
            {
                C1.Win.C1Ribbon.RibbonItem item = (C1.Win.C1Ribbon.RibbonItem)uiElement;
                // set the Name property for the UIElementInfo object
                info.Name = item.ID;
                // set the Parent property for the UIElementInfo object
                // (since a RibbonItem can be inside different parents, we need to consider all cases)
                if (item.Parent != null)
                {
                    info.Parent = item.Parent;
                }
                else if (item.Tab != null)
                {
                    info.Parent = item.Tab;
                }
                else
                {
                    info.Parent = item.Ribbon;
                }
            }
            else if (uiElement is TextBox)
            {
                TextBox txt = (TextBox)uiElement;
                // check if this TextBox is inside a C1Ribbon,
                // then we can handle it here, otherwise we should return null to allow the C1DynamicHelp control to process it
                RibbonItem parent = C1Ribbon.GetHostRibbonItem(txt);
                if (parent == null)
                {
                    return(null);
                }
                info.Parent = parent;
                info.Name   = txt.Name;
            }
            else
            {
                // the uiElement can be handled by the C1DynamicHelp control automatically, so return null
                return(null);
            }

            // check if the uiElement has a name
            if (info.Name == "")
            {
                // if the name is empty, we can use the uiElement's index instead of the name to identify it later inside a parent
                int pos = IndexOf(info);
                if (pos != -1)
                {
                    info.Name = pos.ToString();
                }
            }

            return(info);
        }