public static void setParam(Microsoft.Office.Tools.Ribbon.RibbonControl _ctr, string _opt = "") { try { if (_ctr is Microsoft.Office.Tools.Ribbon.RibbonButton) { Microsoft.Office.Tools.Ribbon.RibbonButton _tempButton = (Microsoft.Office.Tools.Ribbon.RibbonButton)_ctr; //_tempButton.ScreenTip = Resources.Labels.ResourceManager.GetString("Ribbon_Tips_" + _tempButton.Name); setParamButton(_tempButton, _opt); } else if (_ctr is Microsoft.Office.Tools.Ribbon.RibbonSplitButton) { Microsoft.Office.Tools.Ribbon.RibbonSplitButton _tempButton = (Microsoft.Office.Tools.Ribbon.RibbonSplitButton)_ctr; //_tempButton.ScreenTip = Resources.Labels.ResourceManager.GetString("Ribbon_Tips_" + _tempButton.Name); setParamSButton(_tempButton, _opt); } else if (_ctr is Microsoft.Office.Tools.Ribbon.RibbonGallery) { Microsoft.Office.Tools.Ribbon.RibbonGallery _tempButton = (Microsoft.Office.Tools.Ribbon.RibbonGallery)_ctr; _tempButton.ScreenTip = Resources.Labels.ResourceManager.GetString("Ribbon_Tips_" + _tempButton.Name); setParamGallery(_tempButton, _opt); } else if (_ctr is Microsoft.Office.Tools.Ribbon.RibbonToggleButton) { Microsoft.Office.Tools.Ribbon.RibbonToggleButton _tempButton = (Microsoft.Office.Tools.Ribbon.RibbonToggleButton)_ctr; setParamToggle(_tempButton, _opt); } } catch (Exception E) { System.Windows.Forms.MessageBox.Show("There is an interface label configuration error: " + E.Message + ". I don't know what you did, but it's funny. Please, contact application administrator.", "WooTable .::. Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
/*public TabPrewFactory(WooTable _mo, int _tableIndex) * { * ThisApp = Globals.ThisAddIn.Application; * ThisApp.ActiveDocument.Tables[_tableIndex].Range.CopyAsPicture(); * System.Drawing.Image _img = Clipboard.GetImage(); * * Microsoft.Office.Tools.Ribbon.RibbonButton _lab = _mo.Factory.CreateRibbonButton(); * _lab.ShowLabel = false; * _lab.Enabled = false; * _lab.Image = _img; * _obj = _lab; * }*/ public static Microsoft.Office.Tools.Ribbon.RibbonControl CreateTabPrew(WooTable _mo, int _tableIndex) { ThisApp = Globals.ThisAddIn.Application; ThisApp.ActiveDocument.Tables[_tableIndex].Range.CopyAsPicture(); System.Drawing.Image _img = Clipboard.GetImage(); Microsoft.Office.Tools.Ribbon.RibbonButton _lab = _mo.Factory.CreateRibbonButton(); _lab.ShowLabel = false; _lab.Enabled = false; _lab.Image = _img; _obj = _lab; return(_obj); }
/// <summary> /// /// </summary> private void DoDelete() { if (MessageBox.Show("This operation will delete template and related permissions,Are you sure to do this operation?", "Message - RSystems FinanceTools", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { KeyValuePair <string, string> obj = (KeyValuePair <string, string>) this.cbTmpName.SelectedItem; DeleteFile(); DeleteTemplate(obj.Value); DeleteTemplateButtons(obj.Value); DeleteTemplatePermissions(obj.Value); DeleteTemplateVisible(obj.Value); TempName = obj.Key; Predicate <KeyValuePair <string, string> > pred2 = EquaWithButtonName; KeyValuePair <string, string> kv = Ribbon2.TemplateAndPath.Find(pred2); if (kv.Key != null) { cbTmpName.Items.Remove(kv); Ribbon2.TemplateAndPath.Remove(kv); for (int i = 0; i < Ribbon2.ButtonViewCount; i++) { try { Microsoft.Office.Tools.Ribbon.RibbonControl rb = (Microsoft.Office.Tools.Ribbon.RibbonButton)Globals.Ribbons[0].Tabs[0].Groups[2].Items[i]; string[] sArray = System.Text.RegularExpressions.Regex.Split(rb.Tag.ToString(), ","); string templateid = sArray[0]; if (templateid == obj.Value) { rb.Visible = false; } } catch { } } Microsoft.Office.Tools.Ribbon.RibbonGroup rg = (Microsoft.Office.Tools.Ribbon.RibbonGroup)Globals.Ribbons[0].Tabs[0].Groups[3]; for (int j = 0; j < rg.Items.Count; j++) { Microsoft.Office.Tools.Ribbon.RibbonMenu rm = (Microsoft.Office.Tools.Ribbon.RibbonMenu)rg.Items[j]; for (int k = 0; k < rm.Items.Count; k++) { Microsoft.Office.Tools.Ribbon.RibbonToggleButton rtb = (Microsoft.Office.Tools.Ribbon.RibbonToggleButton)rm.Items[k]; if (rtb.Tag == obj.Value) { rtb.Visible = false; } } } } } }