Exemple #1
0
		/// <summary>
		/// Overridden. Returns the copy of the ControlContainerItem.
		/// </summary>
		/// <returns>Copy of the ControlContainerItem.</returns>
		public override BaseItem Copy()
		{
			ControlContainerItem objCopy=new ControlContainerItem(this.Name);
            objCopy.AllowItemResize = this.AllowItemResize;
			this.CopyToItem(objCopy);
			return objCopy;
		}
        public ExportClassV2(string title, Image img)
        {
            InitializeComponent();
            _Title = this.Text = title;
            foreach (WizardPage page in wizard1.WizardPages)
            {
                page.PageTitle = _Title;
                if (img != null)
                {
                    Bitmap b = new Bitmap(48, 48);
                    using (Graphics g = Graphics.FromImage(b))
                        g.DrawImage(img, 0, 0, 48, 48);
                    page.PageHeaderImage = b;
                }
            }

            #region 加入進階跟HELP按鈕
            _OptionsContainer = new PanelEx();
            _OptionsContainer.Font = this.Font;
            _OptionsContainer.ColorSchemeStyle = eDotNetBarStyle.Office2007;
            _OptionsContainer.Size = new Size(100, 100);
            _OptionsContainer.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
            _OptionsContainer.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
            _OptionsContainer.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            _OptionsContainer.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            _OptionsContainer.Style.GradientAngle = 90;
            _Options = new SmartSchool.API.PlugIn.Collections.OptionCollection();
            _Options.ItemsChanged += new EventHandler(_Options_ItemsChanged);

            advContainer = new ControlContainerItem();
            advContainer.AllowItemResize = false;
            advContainer.GlobalItem = false;
            advContainer.MenuVisibility = eMenuVisibility.VisibleAlways;
            advContainer.Control = _OptionsContainer;

            ItemContainer itemContainer2 = new ItemContainer();
            itemContainer2.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
            itemContainer2.MinimumSize = new System.Drawing.Size(0, 0);
            itemContainer2.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
            advContainer});

            advButton = new ButtonX();
            advButton.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            advButton.Text = "    進階";
            advButton.Top = this.wizard1.Controls[1].Controls[0].Top;
            advButton.Left = 5;
            advButton.Size = this.wizard1.Controls[1].Controls[0].Size;
            advButton.Visible = true;
            advButton.SubItems.Add(itemContainer2);
            advButton.PopupSide = ePopupSide.Top;
            advButton.SplitButton = true;
            advButton.Enabled = false;
            advButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            advButton.AutoExpandOnClick = true;
            advButton.SubItemsExpandWidth = 16;
            advButton.FadeEffect = false;
            advButton.FocusCuesEnabled = false;
            this.wizard1.Controls[1].Controls.Add(advButton);

            helpButton = new LinkLabel();
            helpButton.AutoSize = true;
            helpButton.BackColor = System.Drawing.Color.Transparent;
            helpButton.Location = new System.Drawing.Point(81, 10);
            helpButton.Size = new System.Drawing.Size(69, 17);
            helpButton.TabStop = true;
            helpButton.Text = "Help";
            //helpButton.Top = this.wizard1.Controls[1].Controls[0].Top + this.wizard1.Controls[1].Controls[0].Height - helpButton.Height;
            //helpButton.Left = 150;
            helpButton.Visible = false;
            helpButton.Click += delegate { if (HelpButtonClick != null)HelpButtonClick(this, new EventArgs()); };
            helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            this.wizard1.Controls[1].Controls.Add(helpButton);
            #endregion

            #region 設定Wizard會跟著Style跑
            //this.wizard1.FooterStyle.ApplyStyle(( GlobalManager.Renderer as Office2007Renderer ).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.HeaderStyle.ApplyStyle((GlobalManager.Renderer as Office2007Renderer).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.FooterStyle.BackColorGradientAngle = -90;
            this.wizard1.FooterStyle.BackColorGradientType = eGradientType.Linear;
            this.wizard1.FooterStyle.BackColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.FooterStyle.BackColor2 = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.End;
            this.wizard1.BackColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.BackgroundImage = null;
            for (int i = 0; i < 6; i++)
            {
                (this.wizard1.Controls[1].Controls[i] as ButtonX).ColorTable = eButtonColor.OrangeWithBackground;
            }
            (this.wizard1.Controls[0].Controls[1] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.MouseOver.TitleText;
            (this.wizard1.Controls[0].Controls[2] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TitleText;
            #endregion

            this.checkBox1.ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.CheckBoxItem.Default.Text;
            listViewEx1.ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.CheckBoxItem.Default.Text;

            _CheckAllManager.TargetComboBox = this.checkBox1;
            _CheckAllManager.TargetListView = this.listViewEx1;

            advButton.PopupOpen += delegate { if (ControlPanelOpen != null)ControlPanelOpen(this, new EventArgs()); };
            advButton.PopupClose += delegate { if (ControlPanelClose != null)ControlPanelClose(this, new EventArgs()); };

            _ExportableFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _SelectedFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _ExportableFields.ItemsChanged += delegate
            {
                List<string> uncheckItems = new List<string>();
                foreach (ListViewItem item in listViewEx1.Items)
                {
                    if (item != null && item.Checked == false)
                        uncheckItems.Add(item.Text);
                }
                listViewEx1.Items.Clear();

                List<string> newFields = new List<string>(new string[] { "班級系統編號", "班級名稱" });
                //newFields.AddRange(_Process.ExportableFields);
                foreach (string field in _ExportableFields)
                {
                    if (!newFields.Contains(field))
                        newFields.Add(field);
                }
                List<ListViewItem> items = new List<ListViewItem>();
                foreach (string var in newFields)
                {
                    ListViewItem item = new ListViewItem(var);
                    item.Checked = !uncheckItems.Contains(var);
                    items.Add(item);
                }
                listViewEx1.Items.AddRange(items.ToArray());
                listViewEx1_ItemChecked(null, null);
            };
        }
        public ExportStudentV2(string title, Image img)
        {
            InitializeComponent();
            _Title = this.Text = title;
            foreach (WizardPage page in wizard1.WizardPages)
            {
                page.PageTitle = _Title;
                if (img != null)
                {
                    Bitmap b = new Bitmap(48, 48);
                    using (Graphics g = Graphics.FromImage(b))
                        g.DrawImage(img, 0, 0, 48, 48);
                    page.PageHeaderImage = b;
                }
            }

            #region 加入進階跟HELP按鈕
            _OptionsContainer                  = new PanelEx();
            _OptionsContainer.Font             = this.Font;
            _OptionsContainer.ColorSchemeStyle = eDotNetBarStyle.Office2007;
            _OptionsContainer.Size             = new Size(100, 100);
            _OptionsContainer.Style.BackColor1.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
            _OptionsContainer.Style.BackColor2.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
            _OptionsContainer.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            _OptionsContainer.Style.ForeColor.ColorSchemePart   = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            _OptionsContainer.Style.GradientAngle = 90;
            _Options = new SmartSchool.API.PlugIn.Collections.OptionCollection();
            _Options.ItemsChanged += new EventHandler(_Options_ItemsChanged);

            advContainer = new ControlContainerItem();
            advContainer.AllowItemResize = false;
            advContainer.GlobalItem      = false;
            advContainer.MenuVisibility  = eMenuVisibility.VisibleAlways;
            advContainer.Control         = _OptionsContainer;

            ItemContainer itemContainer2 = new ItemContainer();
            itemContainer2.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
            itemContainer2.MinimumSize       = new System.Drawing.Size(0, 0);
            itemContainer2.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
                advContainer
            });

            advButton = new ButtonX();
            advButton.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            advButton.Text           = "    進階";
            advButton.Top            = this.wizard1.Controls[1].Controls[0].Top;
            advButton.Left           = 5;
            advButton.Size           = this.wizard1.Controls[1].Controls[0].Size;
            advButton.Visible        = true;
            advButton.SubItems.Add(itemContainer2);
            advButton.PopupSide           = ePopupSide.Top;
            advButton.SplitButton         = true;
            advButton.Enabled             = false;
            advButton.Anchor              = AnchorStyles.Bottom | AnchorStyles.Left;
            advButton.AutoExpandOnClick   = true;
            advButton.SubItemsExpandWidth = 16;
            advButton.FadeEffect          = false;
            advButton.FocusCuesEnabled    = false;
            this.wizard1.Controls[1].Controls.Add(advButton);

            helpButton           = new LinkLabel();
            helpButton.AutoSize  = true;
            helpButton.BackColor = System.Drawing.Color.Transparent;
            helpButton.Location  = new System.Drawing.Point(81, 10);
            helpButton.Size      = new System.Drawing.Size(69, 17);
            helpButton.TabStop   = true;
            helpButton.Text      = "Help";
            //helpButton.Top = this.wizard1.Controls[1].Controls[0].Top + this.wizard1.Controls[1].Controls[0].Height - helpButton.Height;
            //helpButton.Left = 150;
            helpButton.Visible = false;
            helpButton.Click  += delegate { if (HelpButtonClick != null)
                                            {
                                                HelpButtonClick(this, new EventArgs());
                                            }
            };
            helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            this.wizard1.Controls[1].Controls.Add(helpButton);
            #endregion

            #region 設定Wizard會跟著Style跑
            //this.wizard1.FooterStyle.ApplyStyle(( GlobalManager.Renderer as Office2007Renderer ).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.HeaderStyle.ApplyStyle((GlobalManager.Renderer as Office2007Renderer).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.FooterStyle.BackColorGradientAngle = -90;
            this.wizard1.FooterStyle.BackColorGradientType  = eGradientType.Linear;
            this.wizard1.FooterStyle.BackColor  = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.FooterStyle.BackColor2 = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.End;
            this.wizard1.BackColor       = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.BackgroundImage = null;
            for (int i = 0; i < 6; i++)
            {
                (this.wizard1.Controls[1].Controls[i] as ButtonX).ColorTable = eButtonColor.OrangeWithBackground;
            }
            (this.wizard1.Controls[0].Controls[1] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.MouseOver.TitleText;
            (this.wizard1.Controls[0].Controls[2] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TitleText;
            #endregion


            this.checkBox1.ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.CheckBoxItem.Default.Text;
            listViewEx1.ForeColor    = (GlobalManager.Renderer as Office2007Renderer).ColorTable.CheckBoxItem.Default.Text;

            _CheckAllManager.TargetComboBox = this.checkBox1;
            _CheckAllManager.TargetListView = this.listViewEx1;

            advButton.PopupOpen += delegate { if (ControlPanelOpen != null)
                                              {
                                                  ControlPanelOpen(this, new EventArgs());
                                              }
            };
            advButton.PopupClose += delegate { if (ControlPanelClose != null)
                                               {
                                                   ControlPanelClose(this, new EventArgs());
                                               }
            };

            _ExportableFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _SelectedFields   = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _ExportableFields.ItemsChanged += delegate
            {
                List <string> uncheckItems = new List <string>();
                foreach (ListViewItem item in listViewEx1.Items)
                {
                    if (item != null && item.Checked == false)
                    {
                        uncheckItems.Add(item.Text);
                    }
                }
                listViewEx1.Items.Clear();

                List <string> newFields = new List <string>(new string[] { "學生系統編號", "學號", "班級", "座號", "姓名" });
                //newFields.AddRange(_Process.ExportableFields);
                foreach (string field in _ExportableFields)
                {
                    if (!newFields.Contains(field))
                    {
                        newFields.Add(field);
                    }
                }
                List <ListViewItem> items = new List <ListViewItem>();
                foreach (string var in newFields)
                {
                    ListViewItem item = new ListViewItem(var);
                    item.Checked = !uncheckItems.Contains(var);
                    items.Add(item);
                }
                listViewEx1.Items.AddRange(items.ToArray());
                listViewEx1_ItemChecked(null, null);
            };
        }
        public ImportStudentV2(string title, Image img)
        {
            InitializeComponent();

            #region 加入進階按紐跟HELP按鈕
            _OptionsContainer = new PanelEx();
            _OptionsContainer.Font = this.Font;
            _OptionsContainer.ColorSchemeStyle = eDotNetBarStyle.Office2007;
            _OptionsContainer.Size = new Size(100, 100);
            _OptionsContainer.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
            _OptionsContainer.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
            _OptionsContainer.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            _OptionsContainer.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            _OptionsContainer.Style.GradientAngle = 90;
            _Options = new SmartSchool.API.PlugIn.Collections.OptionCollection();
            _Options.ItemsChanged += new EventHandler(_Options_ItemsChanged);

            advContainer = new ControlContainerItem();
            advContainer.AllowItemResize = false;
            advContainer.GlobalItem = false;
            advContainer.MenuVisibility = eMenuVisibility.VisibleAlways;
            advContainer.Control = _OptionsContainer;

            ItemContainer itemContainer2 = new ItemContainer();
            itemContainer2.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
            itemContainer2.MinimumSize = new System.Drawing.Size(0, 0);
            itemContainer2.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
            advContainer});

            advButton = new ButtonX();
            advButton.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            advButton.Text = "    進階";
            advButton.Top = this.wizard1.Controls[1].Controls[0].Top;
            advButton.Left = 5;
            advButton.Size = this.wizard1.Controls[1].Controls[0].Size;
            advButton.Visible = true;
            advButton.SubItems.Add(itemContainer2);
            advButton.PopupSide = ePopupSide.Top;
            advButton.SplitButton = true;
            advButton.Enabled = false;
            advButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            advButton.AutoExpandOnClick = true;
            advButton.SubItemsExpandWidth = 16;
            advButton.FadeEffect = false;
            advButton.FocusCuesEnabled = false;
            this.wizard1.Controls[1].Controls.Add(advButton);

            helpButton = new LinkLabel();
            helpButton.AutoSize = true;
            helpButton.BackColor = System.Drawing.Color.Transparent;
            helpButton.Location = new System.Drawing.Point(81, 10);
            helpButton.Size = new System.Drawing.Size(69, 17);
            helpButton.TabStop = true;
            helpButton.Text = "Help";
            helpButton.Visible = false;
            helpButton.Click += delegate { if (HelpButtonClick != null)HelpButtonClick(this, new EventArgs()); };
            helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            this.wizard1.Controls[1].Controls.Add(helpButton);
            #endregion

            #region 設定Wizard會跟著Style跑
            //this.wizard1.FooterStyle.ApplyStyle(( GlobalManager.Renderer as Office2007Renderer ).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.HeaderStyle.ApplyStyle((GlobalManager.Renderer as Office2007Renderer).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.FooterStyle.BackColorGradientAngle = -90;
            this.wizard1.FooterStyle.BackColorGradientType = eGradientType.Linear;
            this.wizard1.FooterStyle.BackColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.FooterStyle.BackColor2 = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.End;
            this.wizard1.BackColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.BackgroundImage = null;
            for (int i = 0; i < 6; i++)
            {
                (this.wizard1.Controls[1].Controls[i] as ButtonX).ColorTable = eButtonColor.OrangeWithBackground;
            }
            (this.wizard1.Controls[0].Controls[1] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.MouseOver.TitleText;
            (this.wizard1.Controls[0].Controls[2] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TitleText;
            _CheckAllManager.TargetComboBox = this.checkBox1;
            _CheckAllManager.TargetListView = this.listView1;
            #endregion

            _Title = this.Text = title;

            lblReqFields.Text = "<font color=\"#7A4E2B\"><b>姓名</b> + <b>暱稱</b></font>";

            foreach (WizardPage page in wizard1.WizardPages)
            {
                page.PageTitle = _Title;
                if (img != null)
                {
                    Bitmap b = new Bitmap(48, 48);
                    using (Graphics g = Graphics.FromImage(b))
                        g.DrawImage(img, 0, 0, 48, 48);
                    page.PageHeaderImage = b;
                }
            }
            _RequiredFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _ImportableFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _SelectedFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection();
            _RequiredFields.ItemsChanged += new EventHandler(FieldsChanged);
            _ImportableFields.ItemsChanged += new EventHandler(FieldsChanged);

            // 填入學生狀態選項
            cboStudStatus.Items.Add("一般");
            //cboStudStatus.Items.Add("休學");
            //cboStudStatus.Items.Add("輟學");
            //cboStudStatus.Items.Add("畢業或離校");
            cboStudStatus.Items.Add("刪除");
            cboStudStatus.Text = "一般";
            cboStudStatus.DropDownStyle = ComboBoxStyle.DropDownList;
        }
        private void ShowDropDown(Control dropDownControl)
        {
            if (dropDownControl == null && _PopupItem.SubItems.Count == 0)
                return;
            if (_PopupItem.Expanded)
            {
                _PopupItem.Expanded = false;
                return;
            }

            ControlContainerItem cc = null;
            ItemContainer ic = null;
            if (dropDownControl != null)
            {
                ic = new ItemContainer();
                ic.Name = _DropDownItemContainerName;
                cc = new ControlContainerItem(_DropDownControlContainerName);
                ic.SubItems.Add(cc);
                _PopupItem.SubItems.Insert(0, ic);
            }

            CancelEventArgs cancelArgs = new CancelEventArgs();
            OnButtonDropDownClick(cancelArgs);
            if (cancelArgs.Cancel || _PopupItem.SubItems.Count == 0)
            {
                if (ic != null)
                    _PopupItem.SubItems.Remove(ic);
                return;
            }

            _PreviousDropDownControlParent = dropDownControl.Parent;
            cc.Control = dropDownControl;

            _PopupItem.SetDisplayRectangle(this.ClientRectangle);
            if (this.RightToLeft == RightToLeft.No)
            {
                Point pl = new Point(this.Width - _PopupItem.PopupSize.Width, this.Height);
                ScreenInformation screen = BarFunctions.ScreenFromControl(this);
                Point ps = PointToScreen(pl);
                if (screen != null && screen.WorkingArea.X > ps.X)
                {
                    pl.X = 0;
                }
                _PopupItem.PopupLocation = pl;
            }

            _PopupItem.Expanded = !_PopupItem.Expanded;
        }
Exemple #6
0
		/// <summary>
		/// Create a tree view for the sidebar.
		/// </summary>
		/// <param name="group">The definition for the tree view.</param>
		/// <param name="label"></param>
		/// <param name="panelItem"></param>
		protected void MakeTree(ChoiceGroup group, string label, ref SideBarPanelItem panelItem)
		{
			// TODO: This tree isn't the right size, when the window opens.
			// Figure out how to make it right.
			TreeView tree = new TreeView();
			tree.Tag = group;
			tree.AfterSelect += new TreeViewEventHandler(OnTreeNodeSelected);
			ControlContainerItem containerItem = new ControlContainerItem(group.Id, label);
			containerItem.AllowItemResize = true;
			containerItem.Control = tree;
			panelItem.SubItems.Add(containerItem);
		}
Exemple #7
0
        private void SetupOverflowButton()
        {
            if (m_OverflowButton != null || m_ItemContainer.SubItems.Count==0)
                return;
            m_SuspendRecalcSize = true;

            
            RibbonOverflowButtonItem overflowButton = new RibbonOverflowButtonItem();
            overflowButton.Name = "sysOverflowButton";
            overflowButton.Text = GetOverflowButtonText();
            overflowButton.RibbonBar = this;
            overflowButton.Image = GetOverflowButtonImage();
            overflowButton.ButtonStyle = eButtonStyle.ImageAndText;
            overflowButton.ImagePosition = eImagePosition.Top;
            overflowButton.AutoExpandOnClick = true;
            overflowButton.PopupType = ePopupType.Menu;
            overflowButton.ImagePaddingHorizontal = 16;
            overflowButton.VerticalPadding = 12;
            overflowButton.SubItemsExpandWidth = 14;
            overflowButton.HotTrackingStyle = eHotTrackingStyle.None;
            overflowButton.PopupOpen += new DotNetBarManager.PopupOpenEventHandler(OverflowButton_PopupOpen);
            if (OverflowButtonSetup != null)
                OverflowButtonSetup(this, new OverflowButtonEventArgs(overflowButton));

            ArrayList items = new ArrayList();
            m_ItemContainer.SubItems.CopyTo(items);
            m_ItemContainer.SubItems.Clear();

            //ItemContainer cont = m_ItemContainer.Copy() as ItemContainer;
            //m_OverflowButton.SubItems.Add(cont);
            m_ItemContainer.SubItems.Add(overflowButton);
            m_OverflowRibbonBar = CreateOverflowRibbon();
            m_OverflowRibbonBar.OverflowParent = this;

            m_OriginalVerticalItemAlign = m_ItemContainer.VerticalItemAlignment;
            m_OriginalLayoutOrientation = m_ItemContainer.LayoutOrientation;
            m_OriginalHorizontalItemAlign = m_ItemContainer.HorizontalItemAlignment;
            m_ItemContainer.VerticalItemAlignment = eVerticalItemsAlignment.Top;
            m_ItemContainer.LayoutOrientation = eOrientation.Horizontal;
            m_ItemContainer.HorizontalItemAlignment = eHorizontalItemsAlignment.Center;

            IOwner owner = (IOwner)this;
            foreach (BaseItem item in items)
            {
                m_OverflowRibbonBar.Items.Add(item);
                owner.AddShortcutsFromItem(item);
            }
            
            ItemContainer ic = new ItemContainer();
            ic.Stretch = true;
            ControlContainerItem cont = new ControlContainerItem();
            cont.AllowItemResize = false;
            ic.SubItems.Add(cont);
            cont.Control = m_OverflowRibbonBar;
            overflowButton.SubItems.Add(ic);
			m_ItemContainer.RefreshImageSize();

            m_OverflowButton = overflowButton;

            if (OverflowButtonSetupComplete != null)
                OverflowButtonSetupComplete(this, new OverflowButtonEventArgs(m_OverflowButton));
            m_SuspendRecalcSize = false;
        }
Exemple #8
0
        public PowerfulImportWizard(string title, Image img)
        {
            InitializeComponent();

            #region 加入進階按紐跟HELP按鈕
            _OptionsContainer                  = new PanelEx();
            _OptionsContainer.Font             = this.Font;
            _OptionsContainer.ColorSchemeStyle = eDotNetBarStyle.Office2007;
            _OptionsContainer.Size             = new Size(100, 100);
            _OptionsContainer.Style.BackColor1.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
            _OptionsContainer.Style.BackColor2.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
            _OptionsContainer.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            _OptionsContainer.Style.ForeColor.ColorSchemePart   = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            _OptionsContainer.Style.GradientAngle = 90;
            _Options = new OptionCollection();
            _Options.ItemsChanged += new EventHandler(_Options_ItemsChanged);

            advContainer = new ControlContainerItem();
            advContainer.AllowItemResize = false;
            advContainer.GlobalItem      = false;
            advContainer.MenuVisibility  = eMenuVisibility.VisibleAlways;
            advContainer.Control         = _OptionsContainer;

            ItemContainer itemContainer2 = new ItemContainer();
            itemContainer2.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
            itemContainer2.MinimumSize       = new System.Drawing.Size(0, 0);
            itemContainer2.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
                advContainer
            });

            advButton = new ButtonX();
            advButton.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            advButton.Text           = "    進階";
            advButton.Top            = this.wizard1.Controls[1].Controls[0].Top;
            advButton.Left           = 5;
            advButton.Size           = this.wizard1.Controls[1].Controls[0].Size;
            advButton.Visible        = true;
            advButton.SubItems.Add(itemContainer2);
            advButton.PopupSide           = ePopupSide.Top;
            advButton.SplitButton         = true;
            advButton.Enabled             = false;
            advButton.Anchor              = AnchorStyles.Bottom | AnchorStyles.Left;
            advButton.AutoExpandOnClick   = true;
            advButton.SubItemsExpandWidth = 16;
            advButton.FadeEffect          = false;
            advButton.FocusCuesEnabled    = false;
            this.wizard1.Controls[1].Controls.Add(advButton);

            helpButton           = new LinkLabel();
            helpButton.AutoSize  = true;
            helpButton.BackColor = System.Drawing.Color.Transparent;
            helpButton.Location  = new System.Drawing.Point(81, 10);
            helpButton.Size      = new System.Drawing.Size(69, 17);
            helpButton.TabStop   = true;
            helpButton.Text      = "Help";
            helpButton.Visible   = false;
            helpButton.Click    += delegate { if (HelpButtonClick != null)
                                              {
                                                  HelpButtonClick(this, new EventArgs());
                                              }
            };
            helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            this.wizard1.Controls[1].Controls.Add(helpButton);
            #endregion

            #region 設定Wizard會跟著Style跑
            //this.wizard1.FooterStyle.ApplyStyle(( GlobalManager.Renderer as Office2007Renderer ).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.HeaderStyle.ApplyStyle((GlobalManager.Renderer as Office2007Renderer).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.wizard1.FooterStyle.BackColorGradientAngle = -90;
            this.wizard1.FooterStyle.BackColorGradientType  = eGradientType.Linear;
            this.wizard1.FooterStyle.BackColor  = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.FooterStyle.BackColor2 = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.End;
            this.wizard1.BackColor       = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.wizard1.BackgroundImage = null;
            for (int i = 0; i < 6; i++)
            {
                (this.wizard1.Controls[1].Controls[i] as ButtonX).ColorTable = eButtonColor.OrangeWithBackground;
            }
            (this.wizard1.Controls[0].Controls[1] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.MouseOver.TitleText;
            (this.wizard1.Controls[0].Controls[2] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TitleText;
            _CheckAllManager.TargetComboBox = this.checkBox1;
            _CheckAllManager.TargetListView = this.listView1;
            #endregion

            _Title = this.Text = title;

            lblReqFields.Text = "";

            foreach (WizardPage page in wizard1.WizardPages)
            {
                page.PageTitle = _Title;
                if (img != null)
                {
                    Bitmap b = new Bitmap(48, 48);
                    using (Graphics g = Graphics.FromImage(b))
                        g.DrawImage(img, 0, 0, 48, 48);
                    page.PageHeaderImage = b;
                }
            }
            _RequiredFields                 = new FieldsCollection();
            _ImportableFields               = new FieldsCollection();
            _SelectedFields                 = new FieldsCollection();
            _RequiredFields.ItemsChanged   += new EventHandler(FieldsChanged);
            _ImportableFields.ItemsChanged += new EventHandler(FieldsChanged);
        }
Exemple #9
0
 internal static BaseItem CreateItemFromXml(System.Xml.XmlElement xmlItem)
 {
     string cl = xmlItem.GetAttribute("class");
     BaseItem returnItem = null;
     switch (cl)
     {
         case "DevComponents.DotNetBar.ButtonItem":
             returnItem = new ButtonItem();
             break;
         case "DevComponents.DotNetBar.TextBoxItem":
             returnItem = new TextBoxItem();
             break;
         case "DevComponents.DotNetBar.ComboBoxItem":
             returnItem = new ComboBoxItem();
             break;
         case "DevComponents.DotNetBar.LabelItem":
             returnItem = new LabelItem();
             break;
         case "DevComponents.DotNetBar.CustomizeItem":
             returnItem = new CustomizeItem();
             break;
         case "DevComponents.DotNetBar.ControlContainerItem":
             returnItem = new ControlContainerItem();
             break;
         case "DevComponents.DotNetBar.DockContainerItem":
             returnItem = new DockContainerItem();
             break;
         case "DevComponents.DotNetBar.MdiWindowListItem":
             returnItem = new MdiWindowListItem();
             break;
         case "DevComponents.DotNetBar.SideBarContainerItem":
             returnItem = new SideBarContainerItem();
             break;
         case "DevComponents.DotNetBar.SideBarPanelItem":
             returnItem = new SideBarPanelItem();
             break;
         case "DevComponents.DotNetBar.ExplorerBarGroupItem":
             returnItem = new ExplorerBarGroupItem();
             break;
         case "DevComponents.DotNetBar.ExplorerBarContainerItem":
             returnItem = new ExplorerBarContainerItem();
             break;
         case "DevComponents.DotNetBar.ProgressBarItem":
             returnItem = new ProgressBarItem();
             break;
         case "DevComponents.DotNetBar.ColorPickerDropDown":
             returnItem = new ColorPickerDropDown();
             break;
         default:
             {
                 try
                 {
                     //System.Windows.Forms.MessageBox.Show("Loading custom: "+xmlItem.GetAttribute("assembly")+"   "+xmlItem.GetAttribute("class"));
                     System.Reflection.Assembly a = System.Reflection.Assembly.Load(xmlItem.GetAttribute("assembly"));
                     if (a == null)
                         return null;
                     BaseItem item = a.CreateInstance(xmlItem.GetAttribute("class")) as BaseItem;
                     returnItem = item;
                 }
                 catch (Exception e)
                 {
                     throw new ArgumentException("Could not create item from XML. Assembly=" + xmlItem.GetAttribute("assembly") + ", Class=" + xmlItem.GetAttribute("class") + ", Inner Exception: " + e.Message + ", Source=" + e.Source);
                 }
                 break;
             }
     }
     return returnItem;
 }
Exemple #10
0
        private BaseItem GetQatItemCopy(object o)
        {
            BaseItem copy = null;
            if (o is ButtonItem)
            {
                ButtonItem button = ((ButtonItem)o).Copy() as ButtonItem;
                button.KeyTips = "";
                button.ImageFixedSize = Size.Empty;
                button.FixedSize = Size.Empty;
                button.ButtonStyle = eButtonStyle.Default;
                button.ImagePosition = eImagePosition.Left;
                button.BeginGroup = false;
                button.UseSmallImage = true;

                if (button.TextMarkupBody != null && button.TextMarkupBody.HasExpandElement)
                    button.Text = TextMarkup.MarkupParser.RemoveExpand(button.Text);

                if (button.Image == null && button.ImageIndex == -1 && button.Icon == null)
                    button.Image = BarFunctions.LoadBitmap("SystemImages.GreenLight.png");
                else
                    button.ImageFixedSize = new Size(16, 16);
                copy = button;
            }
            else if (o is BaseItem)
            {
                copy = ((BaseItem)o).Copy();
                copy.KeyTips = "";
            }
            else if (o is RibbonBar)
            {
                RibbonBar bar = o as RibbonBar;
                ButtonItem item = new ButtonItem(GetQATRibbonBarName(bar));
                item.Image = bar.GetOverflowButtonImage();
                item.ImageFixedSize = new Size(16, 16);
                item.AutoExpandOnClick = true;
                item.Tooltip = bar.Text;
                item.Text = bar.Text;
                RibbonBar qatBar = null;
                bool recalcLayout = false;
                if (bar.IsItemsAutoSizeActive)
                {
                    bar.RestoreAutoSizedItems();
                    qatBar = bar.CreateOverflowRibbon(true);
                    recalcLayout = true;
                }
                else
                    qatBar = bar.CreateOverflowRibbon(true);
                qatBar.IsOnQat = true;
                qatBar.QatButtonParent = item;
                foreach (BaseItem child in bar.Items)
                {
                    BaseItem childCopy = child.Copy();
                    qatBar.Items.Add(childCopy);
                }
                if (recalcLayout) bar.RecalcLayout();

                ItemContainer ic = new ItemContainer();
                ic.Stretch = true;
                ControlContainerItem cont = new ControlContainerItem();
                cont.AllowItemResize = false;
                ic.SubItems.Add(cont);
                cont.Control = qatBar;
                item.SubItems.Add(ic);

                copy = item;
            }

            return copy;
        }
Exemple #11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets a toolbar item with the specified name. If the item exists, then return the
		/// one found in the DNB manager. Otherwise, create a new one.
		/// </summary>
		/// <param name="node"></param>
		/// <param name="name"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected BaseItem GetToolbarItem(XmlNode node, string name)
		{
			BaseItem item;

			if (m_barReadFromSettingFile)
			{
				item = m_dnbMngr.GetItem(name, true);
				if (item != null)
					return item;
			}

			int type = GetIntFromAttribute(node, "type", 0);

			// Get nasty if the type in the XML definition is bad.
			if (type < 0 || type > 5)
				throw new Exception(type.ToString() + " is an invalid toolbar item type.");

			switch (type)
			{
				case 4:
					item = new ComboBoxItem(name);
					ComboBoxItem cboItem = item as ComboBoxItem;
					cboItem.ComboWidth = GetIntFromAttribute(node, "width", 25);

					bool ownerDraw = GetBoolFromAttribute(node, "dnboverridedrawing");
					cboItem.ComboBoxEx.DisableInternalDrawing = ownerDraw;

					// Setting the height to 1 will will force height to minimum (but it won't be 1).
					cboItem.ItemHeight = (!ownerDraw ? 1 : cboItem.ComboBoxEx.Font.Height + 1);
					break;

				case 5:
					item = new ControlContainerItem(name);
					item.CanCustomize = false;
					break;

				default:
					// The rest of the types are Button types with various ways of dealing
					// with items that have a popup component.
					item = new SilButtonItem(name);
				switch (type)
				{
					case 1: ((ButtonItem)item).PopupType = ePopupType.ToolBar; break;
					case 2:	((ButtonItem)item).PopupType = ePopupType.Menu;	break;
					case 3: ((ButtonItem)item).PopupType = ePopupType.Container; break;
				}

					break;
			}

			return item;
		}
Exemple #12
0
		protected override void OnDragOver(DragEventArgs de)
		{
			if(m_DragInProgress)
			{
				Point p=this.Control.PointToClient(new Point(de.X,de.Y));
				MouseDragOver(p.X,p.Y);
				de.Effect=DragDropEffects.Move;
				return;
			}

			if(m_EnableItemDragDrop && m_AcceptExternalControls && !this.IsDockableWindow)
			{
				ISelectionService sel=(ISelectionService)this.GetService(typeof(ISelectionService));
				if(sel!=null && sel.PrimarySelection!=this.Component)
				{
					if(sel.PrimarySelection is Control && this.Control.Controls.Contains((Control)sel.PrimarySelection))
					{			
						BaseItem item=GetControlItem(sel.PrimarySelection as Control);
						if(item!=null)
						{
							m_MouseDownPoint=this.Control.PointToClient(new Point(de.X,de.Y));
							m_SuspendInternalCursor=true;
							StartItemDrag(item);
							if(m_TimerDragDrop==null)
							{
								m_TimerDragDrop=new Timer();
								m_TimerDragDrop.Tick+=new EventHandler(this.TimerTickDragDrop);
								m_TimerDragDrop.Interval=100;
								m_TimerDragDrop.Enabled=true;
								m_TimerDragDrop.Start();
							}
						}
						return;
					}
					else if(sel.SelectionCount>1)
					{
						de.Effect=DragDropEffects.None;
						return;
					}
					else if(sel.PrimarySelection is Control && ((Control)sel.PrimarySelection).Parent!=null)
					{
						// New control being added to the container
						BaseItem dragItem=null;
						if(this.IsDockableWindow)
						{
							DockContainerItem dc=new DockContainerItem();
							dc.Name=TEMP_NAME;
							//dc.Control=sel.PrimarySelection as System.Windows.Forms.Control;
							dragItem=dc;
						}
						else
						{
							ControlContainerItem cc=new ControlContainerItem();
							cc.Name=TEMP_NAME;
							//cc.Control=sel.PrimarySelection as System.Windows.Forms.Control;
							dragItem=cc;
						}
						m_MouseDownPoint=this.Control.PointToClient(new Point(de.X,de.Y));
						m_SuspendInternalCursor=true;
						StartItemDrag(dragItem);
					}
				}
			}
			base.OnDragOver (de);
		}