private void SetRibbonColors(RibbonColors colors) { numericUpDownB_R.Value = colors.BackgroundColor.R; numericUpDownB_G.Value = colors.BackgroundColor.G; numericUpDownB_B.Value = colors.BackgroundColor.B; numericUpDownH_R.Value = colors.HighlightColor.R; numericUpDownH_G.Value = colors.HighlightColor.G; numericUpDownH_B.Value = colors.HighlightColor.B; numericUpDownT_R.Value = colors.TextColor.R; numericUpDownT_G.Value = colors.TextColor.G; numericUpDownT_B.Value = colors.TextColor.B; backgroundColorPanel.BackColor = colors.BackgroundColor; highlightColorPanel.BackColor = colors.HighlightColor; textColorPanel.BackColor = colors.TextColor; }
internal RibbonColors GetRibbonColors() { RibbonColors colors = ribbon.GetColors(); //.new RibbonColors(); //IPropertyStore propertyStore = (IPropertyStore)ribbon.Framework; //PropVariant backgroundColorProp; //PropVariant highlightColorProp; //PropVariant textColorProp; //// get ribbon colors //propertyStore.GetValue(ref RibbonProperties.GlobalBackgroundColor, out backgroundColorProp); //propertyStore.GetValue(ref RibbonProperties.GlobalHighlightColor, out highlightColorProp); //propertyStore.GetValue(ref RibbonProperties.GlobalTextColor, out textColorProp); //uint background = (uint)backgroundColorProp.Value; //uint highlight = (uint)highlightColorProp.Value; //uint text = (uint)textColorProp.Value; //colors.BackgroundColor = ColorHelp.UInt32ToRGB(background); //colors.HighlightColor = ColorHelp.UInt32ToRGB(highlight); //colors.TextColor = ColorHelp.UInt32ToRGB(text); return(colors); }
private void GetColorsButton_Click(object sender, EventArgs e) { RibbonColors colors = GetRibbonColors(); SetRibbonColors(colors); //float b_h = colors.BackgroundColor.GetHue(); //float b_s = colors.BackgroundColor.GetSaturation(); //float b_b = colors.BackgroundColor.GetBrightness(); //HSL b_hsl = new HSL(); //b_hsl.H = (b_h / 360.0); //b_hsl.S = (b_s); //b_hsl.L = (b_b); //float h_h = colors.HighlightColor.GetHue(); //float h_s = colors.HighlightColor.GetSaturation(); //float h_b = colors.HighlightColor.GetBrightness(); //HSL h_hsl = new HSL(); //h_hsl.H = (h_h / 360.0); //h_hsl.S = (h_s); //h_hsl.L = (h_b); ; //float t_h = colors.TextColor.GetHue(); //float t_s = colors.TextColor.GetSaturation(); //float t_b = colors.TextColor.GetBrightness(); //HSL t_hsl = new HSL(); //t_hsl.H = (t_h / 360.0); //t_hsl.S = (t_s); //t_hsl.L = (t_b); //HSB b_hsb = ColorHelp.HSLToHSB(b_hsl); //HSB h_hsb = ColorHelp.HSLToHSB(h_hsl); //HSB t_hsb = ColorHelp.HSLToHSB(t_hsl); //uint backgroundresult = ColorHelper.HSBToUInt32(ColorHelper.HSLToHSB(ColorHelper.RGBToHSL(backgroundColor))); //uint highlightresult = ColorHelper.HSBToUInt32(ColorHelper.HSLToHSB(ColorHelper.RGBToHSL(highlightColor))); //uint textresult = ColorHelper.HSBToUInt32(ColorHelper.HSLToHSB(ColorHelper.RGBToHSL(textColor))); //uint backgroundresult = ColorHelp.RGBToUInt32(backgroundColor); //uint highlightresult = ColorHelp.RGBToUInt32(highlightColor); //uint textresult = ColorHelp.RGBToUInt32(textColor); }
private void GetColorsButton_Click(object sender, EventArgs e) { RibbonColors colors = GetRibbonColors(); SetRibbonColors(colors); }
internal RibbonColors GetRibbonColors() { RibbonColors colors = ribbon.GetColors(); return(colors); }