private void colorPickerControl_ColorPicked(object sender, EventArgs e)
		{
			ControlAppearanceColors key = (ControlAppearanceColors)Enum.Parse(
			typeof(ControlAppearanceColors), lstColors.SelectedItem.ToString());

			grid.ControlStyle.SetColor(key, colorPickerControl.SolidColor);

			grid.ControlStyle = grid.ControlStyle;
		}
Exemple #2
0
 /// <summary>
 /// Get or set color for appearance items
 /// </summary>
 /// <param name="colorKey"></param>
 /// <returns></returns>
 public SolidColor this[ControlAppearanceColors colorKey]
 {
     get
     {
         SolidColor color;
         if (this.colors.TryGetValue(colorKey, out color))
         {
             return(color);
         }
         else
         {
             return(SolidColor.Black);
         }
     }
     set { SetColor(colorKey, value); }
 }
		private void btnExportVBNET_Click(object sender, EventArgs e)
		{
			StringBuilder sb = new StringBuilder("Dim rgcs as new ControlAppearanceStyle()");
			sb.AppendLine();

			foreach (var name in Enum.GetNames(typeof(ControlAppearanceColors)))
			{
				ControlAppearanceColors key = (ControlAppearanceColors)Enum.Parse(typeof(ControlAppearanceColors), name);

				Color c = grid.ControlStyle[key];

				sb.AppendLine(string.Format("rgcs(ControlAppearanceColors.{0}) = Color.FromArgb({1},{2},{3},{4})",
					name, c.A, c.R, c.G, c.B));
			}

			sb.AppendLine("rgcs.SelectionBorderWidth = " + numSelectionWidth.Value);

			sb.AppendLine();

			Clipboard.SetText(sb.ToString());

			MessageBox.Show("VB.NET " + LangRes.LangResource.Msg_Source_Code_Exported_Into_Clipboard);
		}
        private void btnExport_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder("ControlAppearanceStyle rgcs = new ControlAppearanceStyle();");

            sb.AppendLine();

            var styleKeys = Enum.GetNames(typeof(ControlAppearanceColors));

            foreach (var name in styleKeys)
            {
                ControlAppearanceColors key = (ControlAppearanceColors)Enum.Parse(typeof(ControlAppearanceColors), name);

                var color = reoGridControl.ControlStyle[key];

                sb.AppendLine(string.Format("rgcs[ControlAppearanceColors.{0}] = Color.FromArgb({1},{2},{3},{4});",
                                            name, color.A, color.R, color.G, color.B));
            }

            sb.AppendLine();

            Clipboard.SetText(sb.ToString());

            MessageBox.Show("Code exported into Clipboard.");
        }
Exemple #5
0
 /// <summary>
 /// Try get a color item from control appearance style set
 /// </summary>
 /// <param name="key">Key used to specify a item</param>
 /// <param name="color">Output color struction</param>
 /// <returns>True if key was found and color could be returned; otherwise return false</returns>
 public bool TryGetColor(ControlAppearanceColors key, out SolidColor color)
 {
     return(this.colors.TryGetValue(key, out color));
 }
Exemple #6
0
 /// <summary>
 /// Set color for appearance item
 /// </summary>
 /// <param name="colorKey">Key of appearance item</param>
 /// <param name="color">Color to be set</param>
 public void SetColor(ControlAppearanceColors colorKey, SolidColor color)
 {
     colors[colorKey] = color;
 }
Exemple #7
0
 /// <summary>
 /// Get color for appearance item
 /// </summary>
 /// <param name="colorKey">key to get the color item</param>
 /// <param name="color">output color get by specified key</param>
 /// <returns>true if color is found by specified key</returns>
 public bool GetColor(ControlAppearanceColors colorKey, out SolidColor color)
 {
     return(colors.TryGetValue(colorKey, out color));
 }
Exemple #8
0
 /// <summary>
 /// Set color for appearance item
 /// </summary>
 /// <param name="colorKey">Key of appearance item</param>
 /// <param name="color">Color to be set</param>
 public void SetColor(ControlAppearanceColors colorKey, SolidColor color)
 {
     colors[colorKey] = color;
     this.CurrentControl?.ApplyControlStyle();
 }