Пример #1
0
 protected override bool SetCreateTypeInfo(IComponent pComponent)
 {
     if (pComponent is RibbonPageItem)
     {
         RibbonPageItem item           = (RibbonPageItem)pComponent;
         IRibbonControl pRibbonControl = item.TryGetDependRibbonControl();
         if (pRibbonControl != null)
         {
             item.LineDistance   = 2;
             item.ColumnDistance = 2;
             //item.ShowBackgroud = true;
         }
     }
     else if (pComponent is RibbonBarItem)
     {
         RibbonBarItem  item           = (RibbonBarItem)pComponent;
         IRibbonControl pRibbonControl = item.TryGetDependRibbonControl();
         if (pRibbonControl != null)
         {
             item.Padding = new Padding(3, 3, 3, 2);
         }
     }
     else if (pComponent is TextBoxItem)
     {
         TextBoxItem    item           = (TextBoxItem)pComponent;
         IRibbonControl pRibbonControl = item.TryGetDependRibbonControl();
         if (pRibbonControl != null)
         {
             item.Size = new Size(100, 21);
         }
     }
     //
     return(base.SetCreateTypeInfo(pComponent));
 }
Пример #2
0
 protected internal override void SelectedComponent(Component component)
 {
     base.SelectedComponent(component);
     //
     if (component is RibbonPageItem)
     {
         RibbonPageItem item           = (RibbonPageItem)component;
         IRibbonControl pRibbonControl = item.TryGetDependRibbonControl();
         if (pRibbonControl != null)
         {
             int index = pRibbonControl.TabPages.IndexOf(item);
             if (index >= 0 && index != pRibbonControl.RibbonPageSelectedIndex)
             {
                 pRibbonControl.RibbonPageSelectedIndex = index;
             }
         }
     }
 }