/// <summary>
        /// Initializes the skin tab.
        /// </summary>
        /// <remarks></remarks>
        private void InitializeSkinTab()
        {
            DependencyObject     obj         = richTextRibbon;
            IEnumerable <Visual> childRibbon = Syncfusion.Windows.Shared.VisualUtils.EnumChildrenOfType(richTextRibbon, typeof(Ribbon));

            if (childRibbon == null || childRibbon.Count() == 0)
            {
                return;
            }
            Ribbon ribbon = childRibbon.First() as Ribbon;

            if (ribbon != null)
            {
                RibbonTab skinTab = null;
                for (int i = 0; i < ribbon.Items.Count; i++)
                {
                    RibbonTab tab = ribbon.Items[i] as RibbonTab;
                    if (tab.Caption == "Skin")
                    {
                        skinTab = tab;
                        break;
                    }
                }
                if (skinTab != null)
                {
                    RibbonComboBox visualStylesBox = (skinTab.Items[0] as RibbonBar).Items[1] as RibbonComboBox;
                    if (visualStylesBox != null)
                    {
                        visualStylesBox.SelectedValue     = CurrentVisualStyle;
                        visualStylesBox.SelectionChanged += VisualStyleComboBox_SelectionChanged;
                    }
                }
            }
        }
        protected override void SetFocusCore()
        {
            RibbonComboBox owner = (RibbonComboBox)Owner;

            if (owner.Focusable)
            {
                if (!owner.Focus())
                {
                    //The focus might have gone to the TextBox inside Combobox if it is editable.
                    if (owner.IsEditable)
                    {
                        TextBox tb = owner.EditableTextBoxSite;
                        if (tb == null || !tb.IsKeyboardFocused)
                        {
                            throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.SetFocusFailed));
                        }
                    }
                    else
                    {
                        throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.SetFocusFailed));
                    }
                }
            }
            else
            {
                throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.SetFocusFailed));
            }
        }
Example #3
0
        public void SetUIElements(RibbonComboBox сurrentFontFemily, RibbonComboBox сurrentFontSize)
        {
            this.currentFontFemily = сurrentFontFemily;
            this.currentFontSize   = сurrentFontSize;

            currentFontSize.SelectedItem = currentFontSize.Items[5];
        }
        protected override void InitCommands(RibbonPanel panel)
        {
            base.InitCommands(panel);

            _cmbLineSpacing = new RibbonComboBox();

            panel.Items.Add(_cmbLineSpacing);

            _cmbLineSpacing.Text          = "Line spacing:";
            _cmbLineSpacing.TextBoxWidth  = 50;
            _cmbLineSpacing.AllowTextEdit = false;

            InsertLineSpacingItem("1", 0);
            InsertLineSpacingItem("1,25", 1);
            InsertLineSpacingItem("1,5", 2);
            InsertLineSpacingItem("2", 3);

            _cmbLineSpacing.TextBoxText = "1";

            //////////////////////////////////////////////////////////////////////////

            RibbonButton btnSelectFont = new RibbonButton("Select Font");

            panel.Items.Add(btnSelectFont);
            btnSelectFont.Image       = Properties.Resources.SelectNotesFont;
            btnSelectFont.SmallImage  = Properties.Resources.SelectNotesFont;
            btnSelectFont.Click      += new EventHandler(OnSelectFont_Clicked);
            btnSelectFont.MouseEnter += _views.MainForm.RibbonButton_MouseEnter;
        }
Example #5
0
        private void BuildPanelCurrency()
        {
            _rb_add_devise            = new RibbonButton("Add devise");
            _rb_add_devise.Click     += new EventHandler(rb_add_devise_Click);
            _rb_add_devise.SmallImage = ((System.Drawing.Image)(Tools4Libraries.Resources.ResourceIconSet16Default.conversion_of_currency));
            _rb_add_devise.Image      = ((System.Drawing.Image)(Tools4Libraries.Resources.ResourceIconSet32Default.conversion_of_currency));

            _rb_textbox_change                   = new RibbonTextBox();
            _rb_textbox_change.Text              = "Value : ";
            _rb_textbox_change.LabelWidth        = 70;
            _rb_textbox_change.TextBoxWidth      = 130;
            _rb_textbox_change.TextBoxValidated += rb_textbox_change_TextBoxTextChanged;

            _rb_cb_currency = new RibbonComboBox();
            _rb_cb_currency.AllowTextEdit     = false;
            _rb_cb_currency.TextBoxValidated += rb_cb_currency_TextBoxTextChanged;
            _rb_cb_currency.Text              = "Used currency : ";
            _rb_cb_currency.LabelWidth        = 100;
            _rb_cb_currency.TextBoxWidth      = 100;

            _rb_cb_change = new RibbonComboBox();
            _rb_cb_change.AllowTextEdit       = false;
            _rb_cb_change.TextBoxTextChanged += rb_cb_change_TextBoxTextChanged;
            _rb_cb_change.Text         = "Changes taux : ";
            _rb_cb_change.LabelWidth   = 100;
            _rb_cb_change.TextBoxWidth = 100;

            _panelCurrency      = new RibbonPanel();
            _panelCurrency.Text = "Currency - change";
            _panelCurrency.Items.Add(_rb_cb_currency);
            _panelCurrency.Items.Add(_rb_cb_change);
            _panelCurrency.Items.Add(_rb_textbox_change);
            _panelCurrency.Items.Add(_rb_add_devise);
        }
 private void InitializeReportTab()
 {
     DependencyObject obj = richTextRibbon;
     IEnumerable<Visual> childRibbon = Syncfusion.Windows.Shared.VisualUtils.EnumChildrenOfType(richTextRibbon, typeof(Ribbon));
     if (childRibbon == null || childRibbon.Count() == 0)
         return;
     Ribbon ribbon = childRibbon.First() as Ribbon;
     if (ribbon != null)
     {
         RibbonTab skinTab = null;
         for (int i = 0; i < ribbon.Items.Count; i++)
         {
             RibbonTab tab = ribbon.Items[i] as RibbonTab;
             if (tab.Caption == "Reports")
             {
                 skinTab = tab;
                 break;
             }
         }
         if (skinTab != null)
         {
             recipients = (skinTab.Items[0] as RibbonBar).Items[1] as RibbonComboBox;
         }
     }
 }
Example #7
0
        public static void LapChanged(object sender, ExecuteEventArgs e)
        {
            RibbonComboBox selectChartViewComboBox = sender as RibbonComboBox;

            if (selectChartViewComboBox == null)
            {
                return;
            }
            s_lap = (int)selectChartViewComboBox.SelectedItem;
            if (s_lap > 0)
            {
                s_lapStartIndex = DataManager.Instance.LapManager.GetStartIndex(s_lap);
                s_lapEndIndex   = DataManager.Instance.LapManager.GetEndIndex(s_lap);
            }
            else
            {
                s_lapStartIndex = 0;
                s_lapEndIndex   = DataManager.Instance.RecordList.Count - 1;
            }
            if (s_lap >= 0)
            {
                List <RecordValues> list = DataManager.Instance.RecordList;
                DateTime            from = list[s_lapStartIndex].Timestamp;
                DateTime            to   = list[s_lapEndIndex].Timestamp;
                TimeSpan            span = new TimeSpan(to.Ticks - from.Ticks);
                ChartHelp.SetIntervals(span);
            }

            DataManager.Instance.ClearChart();
            DataManager.Instance.FillChart();
        }
Example #8
0
        private void LoadList(RibbonComboBox cb)
        {
            try
            {
                _listClient = new ListClient(new DistyClient <DistributionList>());

                var lists = _listClient.GetAsync().Result;
                if (lists == null)
                {
                    return;
                }

                var defaultItem = this.Factory.CreateRibbonDropDownItem();
                defaultItem.Label = " ";
                defaultItem.Tag   = "0";
                cb.Items.Add(defaultItem);

                foreach (var list in lists)
                {
                    var item = this.Factory.CreateRibbonDropDownItem();
                    item.Label = list.Name;
                    item.Tag   = list.Id.ToString();
                    cb.Items.Add(item);
                }

                cb.Text = cb.Items.First().Label;
            }
            catch (Exception ex)
            {
                var exception = ex;
            }
        }
Example #9
0
        public RibbonPreview()
        {
            InitializeComponent();

            var selReportLabel = new C1.Win.C1Ribbon.RibbonButton();

            c1RibbonPreview1.Ribbon.QatItemsHolder.Add(selReportLabel);
            c1RibbonPreview1.Ribbon.Qat.ItemLinks.Add(selReportLabel);
            selReportLabel.Text   = "Select Report:";
            selReportLabel.Click += selReportLabel_Click;

            comboReports = new RibbonComboBox();
            c1RibbonPreview1.Ribbon.QatItemsHolder.Add(comboReports);
            c1RibbonPreview1.Ribbon.Qat.ItemLinks.Add(comboReports);
            comboReports.DropDownStyle = RibbonComboBoxStyle.DropDownList;
            comboReports.TextAreaWidth = 130;
            comboReports.Items.Add(new RibbonButton("Alternating Background"));
            comboReports.Items.Add(new RibbonButton("Conditional Formatting"));
            comboReports.Items.Add(new RibbonButton("Subtotals and Aggregates"));
            comboReports.Items.Add(new RibbonButton("Running Sums"));
            comboReports.Items.Add(new RibbonButton("Cross-tab Reports"));
            comboReports.Items.Add(new RibbonButton("Sorting"));
            comboReports.Items.Add(new RibbonButton("Unbound Images"));
            comboReports.Items.Add(new RibbonButton("Bound Images"));
            comboReports.Items.Add(new RibbonButton("Watermark"));
            comboReports.Items.Add(new RibbonButton("Force Page Breaks"));
            comboReports.Items.Add(new RibbonButton("Suppress or Force Zeros"));
            comboReports.Items.Add(new RibbonButton("Global Constant"));
            comboReports.Items.Add(new RibbonButton("Custom Paper Size"));
            comboReports.Items.Add(new RibbonButton("Gutters"));
            comboReports.Items.Add(new RibbonButton("CanGrow CanShrink"));
            comboReports.ChangeCommitted += new System.EventHandler(this.ComboReports_ChangeCommitted);
        }
Example #10
0
        public Form1()
        {
            InitializeComponent();

            //
            // Build additional RibbonGroup in the Ribbon of C1RibbonPreview control
            RibbonGroup rgReports = new RibbonGroup("Reports");

            _rcbFile                       = new RibbonComboBox();
            _rcbFile.LabelWidth            = 40;
            _rcbFile.Label                 = "File";
            _rcbFile.DropDownStyle         = RibbonComboBoxStyle.DropDownList;
            _rcbFile.SelectedIndexChanged += _rcbFile_SelectedIndexChanged;
            _rcbFile.TextAreaWidth         = 200;
            rgReports.Items.Add(_rcbFile);

            _rcbReport                       = new RibbonComboBox();
            _rcbReport.LabelWidth            = 40;
            _rcbReport.Label                 = "Report";
            _rcbReport.DropDownStyle         = RibbonComboBoxStyle.DropDownList;
            _rcbReport.SelectedIndexChanged += _rcbReport_SelectedIndexChanged;
            _rcbReport.TextAreaWidth         = 200;
            rgReports.Items.Add(_rcbReport);

            // fill _rbFile with initial list of the files
            // added all files in the ..\..\Reports directory
            string[] files = Directory.GetFiles(@"..\..\Reports", "*.xml");
            if (files != null)
            {
                foreach (string file in files)
                {
                    try
                    {
                        string[] reports = C1Report.GetReportList(file);
                        if (reports != null && reports.Length > 0)
                        {
                            RibbonItem ri = _rcbFile.Items.Add(file);
                            ri.ToolTip = file;
                        }
                    }
                    catch
                    {
                        // eat all exceptions if folder contains "not C1Report xmls"
                    }
                }
                if (_rcbFile.Items.Count > 0)
                {
                    _rcbFile.SelectedIndex = 0;
                }
            }

            // add created RibbonGroup to the ribbon
            c1RibbonPreview1.Ribbon.Tabs[0].Groups.Insert(0, rgReports);
        }
        private void LoadSG(string folder, RibbonComboBox combox)
        {
            var files = FolderExtensions.GetFiles(folder, "*.jpg");

            foreach (var item in files)
            {
                combox.DropDownItems.Add(new RibbonLabel {
                    Text = item.FileName
                });
            }
        }
Example #12
0
 void selReportLabel_Click(object sender, EventArgs e)
 {
     foreach (RibbonItem item in c1FlexViewer1.Ribbon.Qat.Items)
     {
         RibbonComboBox rbc = item as RibbonComboBox;
         if (rbc == comboReports)
         {
             rbc.DroppedDown = true;
             break;
         }
     }
 }
Example #13
0
 private void SelectComboBoxItem(
     RibbonComboBox rcb,
     object v)
 {
     for (int i = 0; i < rcb.Items.Count; i++)
     {
         if (rcb.Items[i].Tag.Equals(v))
         {
             rcb.SelectedIndex = i;
             return;
         }
     }
 }
Example #14
0
        private List <string> _load_data_from_combo()
        {
            List <string>  data = new List <string>();
            RibbonComboBox cmb  = Globals.Ribbons.Ribbon1.writeCommentCombo;

            for (int i = 0; i < cmb.Items.Count; i++)
            {
                RibbonDropDownItem itm = cmb.Items[i];
                string             cr  = _br_decode(itm.Label);
                data.Add(cr);
            }
            return(data);
        }
Example #15
0
        private void SmoothChartComboBox_SelectedItemChanged(object sender, ExecuteEventArgs e)
        {
            RibbonComboBox comboBox = sender as RibbonComboBox;
            string         str      = comboBox.StringValue;
            int            avgTime  = int.Parse(str); // = (int)comboBox.SelectedItem;

            _smoothing.AvgTime = avgTime;
            if (ChartCheckBox.BooleanValue)
            {
                ClearAndRemoveSeries();
                ChartCheckBoxCheckedChanged();
            }
        }
Example #16
0
        protected void CreateAutoCalcScoresComboBox()
        {
            _cmbCalcScores = new RibbonComboBox();
            _cmbCalcScores.AllowTextEdit = false;
            _cmbCalcScores.Text          = "Auto-calc Scores: ";

            //////////////////////////////////////////////////////////////////////////

            RibbonButton btn;

            btn        = new RibbonButton("never");
            btn.Tag    = 0;
            btn.Click += btnAutoCalc_Click;
            _cmbCalcScores.DropDownItems.Add(btn);

            btn        = new RibbonButton("1 change");
            btn.Tag    = 1;
            btn.Click += btnAutoCalc_Click;
            _cmbCalcScores.DropDownItems.Add(btn);

            btn        = new RibbonButton("5 changes");
            btn.Tag    = 5;
            btn.Click += btnAutoCalc_Click;
            _cmbCalcScores.DropDownItems.Add(btn);

            btn        = new RibbonButton("10 changes");
            btn.Tag    = 10;
            btn.Click += btnAutoCalc_Click;
            _cmbCalcScores.DropDownItems.Add(btn);

            //////////////////////////////////////////////////////////////////////////

            switch (_views.AutoCalc)
            {
            case 0:
                _cmbCalcScores.TextBoxText = "never";
                break;

            case 1:
                _cmbCalcScores.TextBoxText = "1 change";
                break;

            case 5:
                _cmbCalcScores.TextBoxText = "5 changes";
                break;

            case 10:
                _cmbCalcScores.TextBoxText = "10 changes";
                break;
            }
        }
Example #17
0
        /// <summary>
        /// Bind the SalesOrderLines for a SalesOrder to the Excel sheet.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateSalesOrderDetails(object sender, RibbonControlEventArgs e)
        {
            RibbonComboBox control = (RibbonComboBox)sender;

            if (sender != null)
            {
                txtOrderAmount.Text = GetSalesOrderTotalAmount(control.Text);

                int orderId = GetSalesOrderId(control.Text);
                salesOrderLinesTable =
                    lobData.GetSalesOrderLineItems(orderId);
                this.BindSalesOrderLines(salesOrderLinesTable);
            }
        }
        public void setCboQueDate(RibbonComboBox c, String selected)
        {
            c.Items.Clear();
            int i = 0;

            if (lStf.Count <= 0)
            {
                getlStf();
            }
            c.Items.Add("");
            foreach (BQueueCaller cus1 in lStf)
            {
                c.Items.Add(cus1.queue_call_name);
            }
        }
Example #19
0
        private void FillItems(
            RibbonComboBox rcb,
            Type type)
        {
            rcb.Items.Clear();
            Array values = Enum.GetValues(type);

            string[] names = Enum.GetNames(type);

            for (int i = 0; i < values.Length; i++)
            {
                RibbonButton rb = new RibbonButton(names[i]);
                rb.Tag = values.GetValue(i);
                rcb.Items.Add(rb);
            }
        }
        public void SetValue(string value)
        {
            RibbonComboBox owner = OwningComboBox;

            if (!owner.IsEnabled)
            {
                throw new ElementNotEnabledException();
            }

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            owner.Text = value;
        }
Example #21
0
        public RibbonComboBox setCboUsageT(RibbonComboBox c, String stfid)
        {
            DataTable dt = selectByTempDrugName(stfid);

            c.Items.Clear();
            c.Items.Add("");
            //for (int i = 0; i < dt.Rows.Count; i++)
            int i = 0;

            foreach (DataRow row in dt.Rows)
            {
                c.Items.Add(row[tdrug.temp_drug_name].ToString());
                i++;
            }
            return(c);
        }
Example #22
0
        //フォームからリボンのドロップダウン値を更新する
        private void set_to_combo()
        {
            RibbonComboBox cmb = Globals.Ribbons.Ribbon1.writeCommentCombo;

            cmb.Items.Clear();
            List <string> data = _load_data_from_table();

            for (int i = 0; i < data.Count; i++)
            {
                RibbonDropDownItem itm = Globals.Ribbons.Ribbon1.Factory.CreateRibbonDropDownItem();
                string             cr  = data[i];
                itm.Label = _br_encode(cr);
                cmb.Items.Add(itm);
            }
            MessageBox.Show("値の更新に成功しました!");
            this.Dispose();
        }
Example #23
0
        private void FontSizeComboBox_ChangeCommitted(object sender, EventArgs e)
        {
            RibbonComboBox rcb  = (RibbonComboBox)sender;
            Font           font = this.richTextBox1.SelectionFont;

            if (font == null)
            {
                MessageBox.Show("Cannot change font size while selected text has more than one font.");
                return;
            }

            this.richTextBox1.SelectionFont = new Font(
                font.FontFamily,
                float.Parse(rcb.Text),
                font.Style,
                GraphicsUnit.Point);
        }
Example #24
0
        private void InitializeComboBoxes()
        {
            List <RibbonItem>  selectedItems = new List <RibbonItem>();
            IList <RibbonItem> items         = ribbonItems.Parser.Results.RibbonItems;

            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].RibbonClassName == "RibbonComboBox")
                {
                    selectedItems.Add(items[i]);
                }
            }
            for (int i = 0; i < selectedItems.Count; i++)
            {
                RibbonItem     item  = selectedItems[i];
                RibbonComboBox combo = (RibbonComboBox)classBuilder.BuildRibbonClass(item.RibbonClassName, item.CommandName, item.CommandId);
                combo.RepresentativeString = "XXXXXX";
            }
        }
Example #25
0
        //リボンからからドロップダウンに値を追加する
        private void do_add_comment_from_ribbon()
        {
            RibbonComboBox cmb = Globals.Ribbons.Ribbon1.writeCommentCombo;
            List <string>  arr = new List <string>();

            if (addCommentPreClearCheck.Checked == true)
            {
                do_clear_combo_comment_all();
            }
            for (int i = 0; i < cmb.Items.Count; i++)
            {
                RibbonDropDownItem itm = cmb.Items[i];
                string             cr  = itm.Label;
                arr.Add(cr);
            }
            for (int i = 0; i < arr.Count; i++)
            {
                writeFormSnipetCombo.Items.Add(arr[i]);
            }
            MessageBox.Show("値の追加に成功しました");
        }
        protected override System.Collections.Generic.List <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> children = base.GetChildrenCore();

            // Add TextBox to the children collection
            RibbonComboBox owner = OwningComboBox;

            if (owner != null && owner.IsEditable && owner.EditableTextBoxSite != null)
            {
                AutomationPeer peer = CreatePeerForElement(owner.EditableTextBoxSite);
                if (peer != null)
                {
                    if (children == null)
                    {
                        children = new List <AutomationPeer>(1);
                    }
                    children.Insert(0, peer);
                }
            }

            return(children);
        }
Example #27
0
        public FlexSsrsViewer()
        {
            InitializeComponent();
            C1Zoom.Target = null;

            var selReportLabel = new C1.Win.Ribbon.RibbonButton();

            c1FlexViewer1.Ribbon.QatItemsHolder.Add(selReportLabel);
            c1FlexViewer1.Ribbon.Qat.ItemLinks.Add(selReportLabel);
            selReportLabel.Text   = "Select Report:";
            selReportLabel.Click += selReportLabel_Click;

            comboReports = new RibbonComboBox();
            comboReports.GripHandleVisible     = true;
            comboReports.TextAreaWidth         = 170;
            comboReports.MaxDropDownItems      = 12;
            comboReports.DropDownStyle         = RibbonComboBoxStyle.DropDownList;
            comboReports.SelectedIndexChanged += comboReports_SelectedIndexChanged;

            var coll = comboReports.Items;

            coll.Add(new RibbonButton("Company Sales"));
            coll.Add(new RibbonButton("Customers Near Stores"));
            coll.Add(new RibbonButton("Employee Sales Summary"));
            coll.Add(new RibbonButton("Employee Sales Summary Detail"));
            coll.Add(new RibbonButton("Product Catalog"));
            coll.Add(new RibbonButton("Product Line Sales"));
            coll.Add(new RibbonButton("Sales by Region"));
            coll.Add(new RibbonButton("Sales Order Detail"));
            coll.Add(new RibbonButton("Store Contacts"));
            coll.Add(new RibbonButton("Territory Sales Drilldown"));

            c1FlexViewer1.Ribbon.QatItemsHolder.Add(comboReports);
            c1FlexViewer1.Ribbon.Qat.ItemLinks.Add(comboReports);

            ssrs            = new C1SSRSDocumentSource();
            ssrs.Credential = new System.Net.NetworkCredential("ssrs_demo", "bjqveS5gh89BH1Q", "");
        }
Example #28
0
        public CheckBoxTag(RibbonCheckBox chartCheckBox, int index, string propertyName, RibbonComboBox smoothChartComboBox)
        {
            _series = new Series(propertyName)
            {
                ChartType = SeriesChartType.FastLine,
                Color     = ConfigDefaults.GetColor(index),
            };
            ChartCheckBox               = chartCheckBox;
            _smoothChartComboBox        = smoothChartComboBox;
            chartCheckBox.ExecuteEvent += ChartCheckBoxCheckedChanged;
            this._index        = index;
            this._propertyName = propertyName;
            _propertyFunc      = PropertyNameToDelegate(propertyName);
            if (_smoothAvgAttribute != null)
            {
                if (_smoothChartComboBox != null)
                {
                    _smoothChartComboBox.ExecuteEvent += SmoothChartComboBox_SelectedItemChanged;
                }

                _smoothing = new Smoothing(0);
            }
        }
Example #29
0
        public Form1()
        {
            InitializeComponent();

            _buttonDropA = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropA);
            _buttonDropB = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropB);
            _buttonDropC = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropC);
            _buttonDropD = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropD);
            _buttonDropE = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropE);
            _buttonDropF = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropF);
            _comboBox1   = new RibbonComboBox(_ribbon, (uint)RibbonMarkupCommands.cmdComboBox1);
            _comboBox2   = new RibbonComboBox(_ribbon, (uint)RibbonMarkupCommands.cmdComboBox2);
            _comboBox3   = new RibbonComboBox(_ribbon, (uint)RibbonMarkupCommands.cmdComboBox3);
            _uiCollectionChangedEvent = new UICollectionChangedEvent();

            _buttonDropA.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonDropA_ExecuteEvent);
            _buttonDropB.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonDropB_ExecuteEvent);
            _buttonDropC.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonDropC_ExecuteEvent);
            _buttonDropD.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonDropD_ExecuteEvent);
            _buttonDropE.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonDropE_ExecuteEvent);
            _buttonDropF.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonDropF_ExecuteEvent);

            InitComboBoxes();
        }
        public void DrawComboxDropDown(Graphics g, RibbonComboBox b)
        {
            if (b.DropDownButtonPressed)
            {
                DrawButtonPressed(g, b.DropDownButtonBounds, Corners.None);
            }
            else if (b.DropDownButtonSelected)
            {
                DrawButtonSelected(g, b.DropDownButtonBounds, Corners.None);
            }
            else if(b.Selected)
            {
                DrawButton(g, b.DropDownButtonBounds, Corners.None);
            }

            DrawArrowShaded(g, b.DropDownButtonBounds, RibbonArrowDirection.Down, true);//b.Enabled);
        }
Example #31
0
        /// <summary>
        /// Add windows and tools to the control ribbon.
        /// </summary>
        private void AddRibbonItems()
        {
            foreach (var aTool in this.toolItems)
            {
                var          tool     = aTool;
                RibbonPanel  group    = GetRibbonPanel(tool);
                RibbonButton toolItem = new RibbonButton(tool.Caption);
                SetupToolbarItem(tool, toolItem);
                group.Items.Add(toolItem);
                tool.ToolbarItemInitialized();
            }

            foreach (var aGroupedTool in this.groupedToolItems)
            {
                var         groupedTool = aGroupedTool;
                RibbonPanel group       = GetRibbonPanel(groupedTool);

                RibbonButtonList hostList = null;
                if (groupedTool.IsButtonList)
                {
                    hostList = new RibbonButtonList();
                    hostList.ButtonsSizeMode = RibbonElementSizeMode.DropDown;
                    //hostList.MaxSizeMode = RibbonElementSizeMode.Compact;
                    //hostList.MinSizeMode = RibbonElementSizeMode.Compact;
                    //hostList.Text = "Hello";
                    group.Items.Add(hostList);
                }

                foreach (var tool in groupedTool.ToolbarItems)
                {
                    RibbonButton toolItem = new RibbonButton(tool.Caption);

                    if (groupedTool.IsButtonList)
                    {
                        hostList.Buttons.Add(toolItem);
                    }
                    else
                    {
                        group.Items.Add(toolItem);
                    }
                    SetupToolbarItem(tool, toolItem);
                }
                groupedTool.ToolbarItemInitialized();
            }

            foreach (var aMenuTool in this.menuButtonToolItems)
            {
                var         menuTool = aMenuTool.Value;
                RibbonPanel group    = GetRibbonPanel(menuTool);

                RibbonButton theButton = new RibbonButton(menuTool.Caption);
                theButton.Style = RibbonButtonStyle.SplitDropDown;
                theButton.DropDownItemClicked +=
                    delegate(object sender, RibbonItemEventArgs e)
                {
                    menuTool.MenuItemClicked(e.Item.Text);
                };

                SetupToolbarItem(menuTool, theButton);

                group.Items.Add(theButton);

                foreach (var menuItem in menuTool.MenuItems)
                {
                    RibbonItem item = new RibbonButton(menuItem);
                    theButton.DropDownItems.Add(item);
                }
                if (theButton.DropDownItems.Count == 0)
                {
                    theButton.Style = RibbonButtonStyle.Normal;
                }
                menuTool.ToolbarItemInitialized();
            }

            foreach (var aComboTool in this.comboToolItems)
            {
                var         comboTool = aComboTool;
                RibbonPanel group     = GetRibbonPanel(comboTool);

                RibbonComboBox theButton = new RibbonComboBox();
                theButton.Text          = ""; // comboTool.Caption;
                theButton.AllowTextEdit = false;
                //if (theButton.Text.Length == 0)
                //{
                //  theButton.LabelWidth = 1;
                //}
                //else
                if (comboTool.Image == null)
                {
                    RibbonLabel label = new RibbonLabel();
                    label.Text = comboTool.Caption;
                    group.Items.Add(label);
                }
                theButton.Image = comboTool.Image;
                //theButton.SmallImage = comboTool.SmallImage;
                //theButton.CheckOnClick = comboTool.CheckOnClick;
                //theButton.Style = RibbonButtonStyle.SplitDropDown;
                theButton.DropDownItemClicked +=
                    delegate(object sender, RibbonItemEventArgs e)
                {
                    comboTool.ComboItemClicked(e.Item.Text);
                };
                comboTool.ComboSelectedTextChanged +=
                    delegate(object o, Core.Window.Events.ComboSelectedTextChangedEventArgs e)
                {
                    //theButton.SelectedValue = e.Text;
                    theButton.TextBoxText = e.Text;
                };

                this.toolToUiMap[comboTool] = theButton;

                group.Items.Add(theButton);

                //comboTool.ComboItemsChanged;
                foreach (var comboItem in comboTool.ComboItems)
                {
                    RibbonItem item = new RibbonButton(comboItem);
                    theButton.DropDownItems.Add(item);
                }

                comboTool.ComboItemsAdded +=
                    delegate(object sender, Core.Window.Events.ComboItemsAddedEvent e)
                {
                    theButton.DropDownItems.Clear();
                    foreach (var item in comboTool.ComboItems)
                    {
                        theButton.DropDownItems.Add(new RibbonButton(item));
                    }
                };

                comboTool.ToolbarItemInitialized();
            }

            foreach (var aUpDownTool in this.upDownToolItems)
            {
                var         upDownTool = aUpDownTool;
                RibbonPanel group      = GetRibbonPanel(upDownTool);

                RibbonUpDown theButton = new RibbonUpDown();
                theButton.Text  = upDownTool.Caption;
                theButton.Image = upDownTool.Image;

                this.toolToUiMap[upDownTool] = theButton;

                theButton.Value            = upDownTool.InitialValue.ToString();
                theButton.UpButtonClicked +=
                    delegate(object sender, MouseEventArgs e)
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Left)
                    {
                        int val = 0;
                        if (int.TryParse(theButton.Value, out val))
                        {
                            val += upDownTool.Interval;
                            if (val <= upDownTool.MaximumValue)
                            {
                                upDownTool.Value      = val;
                                theButton.Value       = val.ToString();
                                theButton.TextBoxText = theButton.Value;
                                upDownTool.Click();
                            }
                        }
                    }
                };
                theButton.DownButtonClicked +=
                    delegate(object sender, MouseEventArgs e)
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Left)
                    {
                        int val = 0;
                        if (int.TryParse(theButton.Value, out val))
                        {
                            val -= upDownTool.Interval;
                            if (val >= upDownTool.MinimumValue)
                            {
                                upDownTool.Value      = val;
                                theButton.Value       = val.ToString();
                                theButton.TextBoxText = theButton.Value;
                                upDownTool.Click();
                            }
                        }
                    }
                };

                ////theButton.
                ////theButton.SmallImage = comboTool.SmallImage;
                ////theButton.CheckOnClick = comboTool.CheckOnClick;
                ////theButton.Style = RibbonButtonStyle.SplitDropDown;
                //theButton.DropDownItemClicked +=
                //  delegate(object sender, RibbonItemEventArgs e)
                //  {
                //    upDownTool.ComboItemClicked(e.Item.Text);
                //  };
                //group.Items.Add(theButton);

                //upDownTool.ButtonStatusChanged +=
                //  delegate(object o, Window.ToolbarItemEvent e)
                //  {
                //    theButton.Enabled = e.IsEnabled;
                //  };

                ////comboTool.ComboItemsChanged;
                //foreach (var comboItem in upDownTool.ComboItems)
                //{
                //  RibbonItem item = new RibbonButton(comboItem);
                //  theButton.DropDownItems.Add(item);
                //}

                //upDownTool.ComboItemsAdded +=
                //  delegate(object sender, ComboItemsAddedEvent e)
                //  {
                //    theButton.DropDownItems.Clear();
                //    foreach (var item in upDownTool.ComboItems)
                //    {
                //      theButton.DropDownItems.Add(new RibbonButton(item));
                //    }
                //  };

                upDownTool.ToolbarItemInitialized();
            }

            foreach (var hostItem in this.hostedItems)
            {
                RibbonPanel group = GetRibbonPanel(hostItem);

                RibbonButton theButton = new RibbonButton();
                theButton.Text       = hostItem.Caption;
                theButton.Image      = hostItem.Image;
                theButton.SmallImage = hostItem.SmallImage;
                theButton.Style      = RibbonButtonStyle.DropDown;

                this.toolToUiMap[hostItem] = theButton;

                var uiHost = new RibbonHost();
                uiHost.HostedControl = hostItem.UserControl;
                theButton.DropDownItems.Add(uiHost);

                hostItem.UserControlFinished +=
                    delegate
                {
                    uiHost.HostCompleted();
                };

                group.Items.Add(theButton);
                hostItem.ToolbarItemInitialized();
            }

            this.ribbon.Tabs.Sort(TabSorter);
        }