public void OnColorEnter(ColorButton color) { if (selectedColor == null || color != selectedColor) { selectedColor = color; } }
public WechselGeldEingabe(Coins coin) { this.InitializeComponent(); this.coin = coin; bild.Source = bmps[coin]; eingabe = new ColorButton(ColorButton.BLAU) { FontSize = (double)App.ResourceDict["NormalFont"] }; right = new ColorButton(ColorButton.GREEN) { FontSize = eingabe.FontSize }; right2 = new ColorButton(ColorButton.GREEN) { FontSize = eingabe.FontSize }; wrong = new ColorButton(ColorButton.RED) { FontSize = eingabe.FontSize }; rightContainer.Child = right; wrongContainer.Child = wrong; eingabeContainer.Child = eingabe; }
public MainForm(string name) { Text = name; Size = new Size(195, 155); FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; ColorButton red = new ColorButton("красный", Color.Red); red.SetBounds(40, 20, 100, 20); red.Click += (x, y) => BackColor = red.Color; ColorButton green = new ColorButton("зеленый", Color.Green); green.SetBounds(40, 40, 100, 20); green.Click += (x, y) => BackColor = green.Color; ColorButton blue = new ColorButton("синий", Color.DarkBlue); blue.SetBounds(40, 60, 100, 20); blue.Click += (x, y) => BackColor = blue.Color; ColorButton yellow = new ColorButton("желтый", Color.Yellow); yellow.SetBounds(40, 80, 100, 20); yellow.Click += (x, y) => BackColor = yellow.Color; Controls.Add(red); Controls.Add(green); Controls.Add(blue); Controls.Add(yellow); }
private void AddBackColorUI(int y, ref int tabindex) { Label num = new Label(); num.TextAlign = ContentAlignment.MiddleCenter; num.Text = TerminalUIPlugin.Instance.Strings.GetString("Caption.EditEscapesequenceColor.BackColor"); num.Left = 8; num.Width = 48; num.Top = y; num.Height = 24; num.TabIndex = tabindex++; ColorButton col = new ColorButton(); col.SelectedColor = _backColor; col.Left = 122; col.Width = 128; col.Top = y + 2; col.ColorChanged += new ColorButton.NewColorEventHandler(OnNewBackColor); col.TabIndex = tabindex++; _backColorBox = col; this.Controls.Add(num); this.Controls.Add(col); }
public void SelectColor(ColorButton colorButton) { selectedColor = colorButton.color; if (shipId == 0) { Synchronisator.Instance.shipColor1 = selectedColor; } else if (shipId == 1) { Synchronisator.Instance.shipColor2 = selectedColor; } for (int i = 0; i < allColors.Count; i++) { allColors[i].Select(allColors[i] == colorButton); if (shipId == 0 && allColors[i] == colorButton) { colorNumber = i; colorElements.SetColor(selectedColor); } } shipSelection.SetColor(selectedColor); }
public override Widget Create(object caller) { Drawing.Color val = (Drawing.Color) field.GetValue(Object); colorButton = new ColorButton(); //Console.WriteLine("ChooseColorWidget Create val {0},{1},{2},{3}", val.Red, val.Green, val.Blue, val.Alpha); // Get if we should use alpha ChooseColorSettingAttribute chooseColorSetting = (ChooseColorSettingAttribute) field.GetCustomAttribute(typeof(ChooseColorSettingAttribute)); useAlpha = chooseColorSetting.UseAlpha; if (useAlpha) colorButton.UseAlpha = true; Gdk.Color color = new Gdk.Color(); color.Red = (ushort) (val.Red * 65535f); color.Green = (ushort) (val.Green * 65535f); color.Blue = (ushort) (val.Blue * 65535f); if (useAlpha) colorButton.Alpha = (ushort) (val.Alpha * 65535f); colorButton.Color = color; colorButton.ColorSet += OnChooseColor; colorButton.Name = field.Name; // Create a tooltip if we can. CreateToolTip(caller, colorButton); return colorButton; }
public override Widget Create(object caller) { colorButton = new ColorButton(); //Console.WriteLine("ChooseColorWidget Create val {0},{1},{2},{3}", val.Red, val.Green, val.Blue, val.Alpha); // Get if we should use alpha ChooseColorSettingAttribute chooseColorSetting = (ChooseColorSettingAttribute) Field.GetCustomAttribute(typeof(ChooseColorSettingAttribute)); useAlpha = chooseColorSetting.UseAlpha; if (useAlpha) { colorButton.UseAlpha = true; } OnFieldChanged(Field); colorButton.ColorSet += OnChooseColor; colorButton.Name = Field.Name; // Create a tooltip if we can. CreateToolTip(caller, colorButton); return(colorButton); }
public ConcentrateController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.CONCENTRATE], this, () => new ConcentrateAufgabe()); for (int i = 0; i < buttons.Length; i++) { buttons[i] = new Button(); buttons[i].Style = (Style) new ResourceDictionary { Source = new Uri("ms-appx:///Pages/ResourceDictionaries/MainButton.xaml") }["MainButtonStyle"]; buttons[i].FontSize = (Double)App.ResourceDict["NormalFont"]; int zahl = i; buttons[i].Click += (sender, e) => Go(zahl); Border border = new Border { CornerRadius = new CornerRadius(15), Margin = new Thickness(0, 15, 0, 15), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Child = buttons[i] }; Container.Children.Add(border); } right = new ColorButton(ColorButton.GREEN); wrong = new ColorButton(ColorButton.RED); right.FontSize = (Double)App.ResourceDict["NormalFont"]; wrong.FontSize = (Double)App.ResourceDict["NormalFont"]; }
protected void HandleButtonPopupMenu(object sender, ButtonPressEventArgs e) { if (e.Event.Button == 3) { // right mouse button ColorButton cb = (ColorButton)sender; Menu m = new Menu(); MenuItem hexPopupItem = new MenuItem("Copy He_x"); MenuItem hslPopupItem = new MenuItem("Copy HS_L"); MenuItem hsvPopupItem = new MenuItem("Copy HS_V"); MenuItem addPopupItem = new MenuItem("_Add"); hexPopupItem.Activated += (o, a) => { clipboard.Text = cb.Color.ToRgbColor().ToHtml(); }; hslPopupItem.Activated += (o, a) => { clipboard.Text = cb.Color.ToRgbColor().ToHslString(); }; hsvPopupItem.Activated += (o, a) => { clipboard.Text = cb.Color.ToHsvColor().ToString(); }; addPopupItem.Activated += (o, a) => { appPal.AppendColor(cb.Color.ToRgbColor()); }; m.Add(hexPopupItem); m.Add(hslPopupItem); m.Add(hsvPopupItem); m.Add(addPopupItem); m.ShowAll(); m.Popup(); } }
public void SyncAppViewState(object sender, EventArgs e) { schemeBox.Active = GetSchemeList().ToList() .FindIndex(x => x.Type == app.SchemeType); foreach (ColorButton cb in colorBox.Children) { colorBox.Remove(cb); } foreach (HsvColor c in app.Results) { ColorButton cb = new ColorButton(c.ToGdkColor()); cb.UseAlpha = false; cb.ColorSet += OnColorChooserColorChanged; cb.TooltipText = String.Format("{0}\r\n{1}\r\n{2}", c.ToRgb().ToHtml(), c.ToRgb().ToHslString(), c.ToString()); // bind the menu too cb.ButtonPressEvent += HandleButtonPopupMenu; colorBox.PackStart(cb, true, true, 0); } colorBox.ShowAll(); UpdateUI(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); if (savedInstanceState != null) { SupportActionBar.Title = savedInstanceState.GetString("LLAVE_GUARDADA"); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); RelativeLayout relativeLayout = FindViewById <RelativeLayout>(Resource.Id.relativeLayout); ColorButton myColorButton = new ColorButton(this); myColorButton.Text = "My Color Button"; myColorButton.Id = 100; RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); layoutParams.AddRule(LayoutRules.Below, Resource.Id.linearPersonalizado); myColorButton.LayoutParameters = layoutParams; relativeLayout.AddView(myColorButton); LayoutPersonalizado linearPersonalizado = new LayoutPersonalizado(this); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); layoutParams2.AddRule(LayoutRules.Below, Resource.Id.linearPersonalizado); linearPersonalizado.LayoutParameters = layoutParams2; relativeLayout.AddView(linearPersonalizado); }
public void OnColorSelected(ColorButton color) { selectedColor = color; colorPanel.SetActive(false); current.GetComponent <Image>().color = selectedColor.button.GetComponent <Image>().color; customManager.custom.GetComponent <SpriteRenderer>().color = selectedColor.button.GetComponent <Image>().color; }
/// <summary> /// Initializes a new instance of the <see cref="Color"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Color(Control.ControlBase parent) : base(parent) { button = new ColorButton(textBox); button.Dock = Pos.Right; button.Width = 20; button.Margin = new Margin(1, 1, 1, 2); button.Clicked += onButtonPressed; }
/// <summary> /// Initializes a new instance of the <see cref="ColorProperty"/> class. /// </summary> /// <param name="parent">Parent control.</param> public ColorProperty(Control.ControlBase parent) : base(parent) { m_Button = new ColorButton(m_TextBox); m_Button.Dock = Dock.Right; m_Button.Width = 20; m_Button.Margin = new Margin(1, 1, 1, 2); m_Button.Clicked += OnButtonPressed; }
/// <summary> /// Initializes a new instance of the <see cref="Color" /> class. /// </summary> /// <param name="parent">Parent control.</param> public Color(Control.Base parent) : base(parent) { mButton = new ColorButton(mTextBox); mButton.Dock = Pos.Right; mButton.Width = 20; mButton.Margin = new Margin(1, 1, 1, 2); mButton.Clicked += OnButtonPressed; }
public void Subscribe(ColorButton color) { if (colors == null) { colors = new List <ColorButton>(); } colors.Add(color); }
public ColorButtonCollection() { for (int i = (int)ColorPalette.Value.RED; i < ColorPalette.MAX_NUM; ++i) { ColorButton button = new ColorButton(ColorPalette.brush[(int)color], color); color = (ColorPalette.Value)((int)color + 1); buttons.Add(button); } }
/// <summary> /// Initializes a new instance of the <see cref="Color"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Color(Control.Base parent) : base(parent) { m_Button = new ColorButton(m_TextBox) { Dock = Pos.Right, Width = 20, Margin = new Margin(1, 1, 1, 2) }; m_Button.Clicked += OnButtonPressed; }
private ColorButton CreateColorButton(string hex) { ColorButton ret = new ColorButton(); ret.Show(); ParseColor(ret, hex); return(ret); }
private bool ShouldLampBeOn(ColorButton button) { //Color index 0 is off on the Spyder's RGB buttons. //If a button is dim or off, then don't light the SM3 button if (button.Dim || button.Color == (int)PaletteColors.PropertyUnselected || button.Color == (int)PaletteColors.PropertyUnselected) { return(false); } return(true); }
/// <summary> /// Creates a button for selecting the specified color /// </summary> /// <param name="location">The location for the button</param> /// <param name="color">The color that this button is for</param> /// <param name="isSelected">Whether the button is the selected one by default</param> /// <returns></returns> private TextureButton CreateColorButton(Location location, Color color, bool isSelected) { TextureButton colorButton = new ColorButton(location, color); if (isSelected) { selectedButton = colorButton; colorButton.Selected = true; } colorButton.Click += OnColorClick; return(colorButton); }
protected void OnExportTypeSelectionChanged(object sender, EventArgs e) { if (ExportTypeSelection.Active == (int)ExportType.SVG) { ColorButton.Hide(); label3.Hide(); } else { ColorButton.Show(); label3.Show(); } }
// Use this for initialization void Start() { for (int i = 0; i < labels.Length; i++) { GameObject g = (GameObject)Instantiate(button, Vector3.zero, Quaternion.identity); g.transform.parent = panel.transform; g.GetComponentInChildren <Text>().text = labels[i]; ColorButton cb = g.GetComponent <ColorButton>(); cb.color = colors[i]; cb.target = target; } }
public void SelectColorChangedHandler(object sender, bool selection) { foreach (var btn in _colorButtons) { if (btn != sender) { btn.IsSelected = false; } } _selectingColorButton = sender as ColorButton; _view.OnSelectColorChanged(_selectingColorButton.Color); }
private void ColorButton_Click(object sender, EventArgs args) { ColorButton button = (sender as ColorButton); if (button != null) { ColorDialog dialog = new ColorDialog(); dialog.Color = button.Color; if (DialogResult.OK == dialog.ShowDialog()) { button.Color = dialog.Color; } } }
private QuickKeyColor GetQuickKeyColor(ColorButton button) { if (button.Color == (int)PaletteColors.Off) { return(QuickKeyColor.Off); } else if (button.Dim) { return(QuickKeyColor.Green); } return(QuickKeyColor.Red); }
/// <summary> /// Load our categories. /// </summary> private void LoadCategories() { // Clear root foreach (Transform child in elementRoot.transform) { Destroy(child.gameObject); } // Clear root foreach (Transform child in categoryRoot.transform) { Destroy(child.gameObject); } options = new Dictionary <string, Dictionary <string, BaseSettingsElement[]> >(); Dictionary <string, Dictionary <string, SettingsOption[]> > categories = PrototypeManager.SettingsCategories.Values.ToArray().SelectMany(x => x.categories).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); foreach (string currentName in categories.Keys) { ColorButton button = Instantiate(categoryPrefab).GetComponent <ColorButton>(); button.transform.SetParent(categoryRoot.transform); button.name = currentName; button.SetText(LocalizationTable.GetLocalization(currentName)); options.Add(currentName, new Dictionary <string, BaseSettingsElement[]>()); // This is quite optimised (despite being a forloop on a dictionary), and is only done during start foreach (KeyValuePair <string, SettingsOption[]> keyValuePair in categories[currentName]) { options[currentName].Add(keyValuePair.Key, new BaseSettingsElement[keyValuePair.Value.Length]); for (int i = 0; i < keyValuePair.Value.Length; i++) { if (FunctionsManager.SettingsMenu.HasFunction("Get" + keyValuePair.Value[i].className)) { BaseSettingsElement element = FunctionsManager.SettingsMenu.Call("Get" + keyValuePair.Value[i].className).ToObject <BaseSettingsElement>(); element.option = keyValuePair.Value[i]; element.parameterData = keyValuePair.Value[i].options; element.InitializeLUA(); options[currentName][keyValuePair.Key][i] = element; } else if (keyValuePair.Value[i].name != null) { Debug.LogWarning("Get" + keyValuePair.Value[i].className + "() Doesn't exist"); } } } } }
public override void OnComponentInteract(BaseComponent component, object data = null) { base.OnComponentInteract(component, data); if (isCompleted) { return; } ColorButton button = component as ColorButton; RotateRowColumn(button.ButtonType, button.ID, button.ButtonDirection); CheckPuzzleComplete(); }
/// <summary> /// Load our categories. /// </summary> private void LoadCategories() { // Clear root foreach (Transform child in elementRoot.transform) { Destroy(child.gameObject); } // Clear root foreach (Transform child in categoryRoot.transform) { Destroy(child.gameObject); } options = new Dictionary <string, Dictionary <string, BaseSettingsElement[]> >(); List <SettingsCategory> categories = PrototypeManager.SettingsCategories.Values; for (int i = 0; i < categories.Count; i++) { ColorButton button = Instantiate(categoryPrefab).GetComponent <ColorButton>(); button.transform.SetParent(categoryRoot.transform); button.name = categories[i].Type; button.SetText(LocalizationTable.GetLocalization(categories[i].Type)); options.Add(categories[i].Type, new Dictionary <string, BaseSettingsElement[]>()); foreach (KeyValuePair <string, List <SettingsOption> > keyValuePair in categories[i].headings) { options[categories[i].Type].Add(keyValuePair.Key, new BaseSettingsElement[keyValuePair.Value.Count]); for (int j = 0; j < keyValuePair.Value.Count; j++) { if (FunctionsManager.SettingsMenu.HasFunction("Get" + keyValuePair.Value[j].classData.ClassName)) { BaseSettingsElement element = FunctionsManager.SettingsMenu.Call("Get" + keyValuePair.Value[j].classData.ClassName).ToObject <BaseSettingsElement>(); element.option = keyValuePair.Value[j]; element.parameterData = keyValuePair.Value[j].classData.ParameterData; element.InitializeLUA(); options[categories[i].Type][keyValuePair.Key][j] = element; } else if (keyValuePair.Value[j].name != null) { UnityDebugger.Debugger.LogError("Get" + keyValuePair.Value[j].classData.ClassName + "() Doesn't exist"); } } } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); RelativeLayout relativeLayout = FindViewById <RelativeLayout>(Resource.Id.relativeLayout); ColorButton myColorButton = new ColorButton(this); myColorButton.Text = "My Color Button"; RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); layoutParams.AddRule(LayoutRules.RightOf, Resource.Id.colorbutton1); myColorButton.LayoutParameters = layoutParams; relativeLayout.AddView(myColorButton); }
void SetupColors() { colors = new ColorButton[GameManager.Instance.painter.colors.Length]; for (int xx = 1; xx < GameManager.Instance.painter.colors.Length; xx++) { ColorButton button = Instantiate(newButton); colors [xx] = button; button.transform.SetParent(colorButtonParent.transform); button.myText.text = xx.ToString(); button.myCol.color = GameManager.Instance.painter.colors [xx]; button.colIndex = xx; button.countText.text = GameManager.Instance.painter.colorCount [xx].ToString(); button.SetupSelf(); } LayoutRebuilder.MarkLayoutForRebuild(colorButtonParent.GetComponent <RectTransform> ()); }
private void AddColorsToSwatch() { ColorButton[] colorButtons = new ColorButton[] { new ColorButton((Color)ColorConverter.ConvertFromString("#000000")), new ColorButton((Color)ColorConverter.ConvertFromString("#FFFFFF")), new ColorButton((Color)ColorConverter.ConvertFromString("#8064A2")), new ColorButton((Color)ColorConverter.ConvertFromString("#4BACC6")), new ColorButton((Color)ColorConverter.ConvertFromString("#F79646")), new ColorButton((Color)ColorConverter.ConvertFromString("#FF0000")), new ColorButton((Color)ColorConverter.ConvertFromString("#FFFF00")), new ColorButton((Color)ColorConverter.ConvertFromString("#92D050")) }; foreach (ColorButton btn in colorButtons) { btn.Click += (s, e) => { Color = (btn.Background as SolidColorBrush).Color; }; this.Children.Add(btn); } }
public override Widget Create(object caller) { colorButton = new ColorButton(); //Console.WriteLine("ChooseColorWidget Create val {0},{1},{2},{3}", val.Red, val.Green, val.Blue, val.Alpha); // Get if we should use alpha ChooseColorSettingAttribute chooseColorSetting = (ChooseColorSettingAttribute) Field.GetCustomAttribute(typeof(ChooseColorSettingAttribute)); useAlpha = chooseColorSetting.UseAlpha; if (useAlpha) colorButton.UseAlpha = true; OnFieldChanged(Field); colorButton.ColorSet += OnChooseColor; colorButton.Name = Field.Name; // Create a tooltip if we can. CreateToolTip(caller, colorButton); return colorButton; }
private ColorButton GenerateOriginColorButton() { double lineWidth = RSpan() - 3; ColorButton colorbutton = new ColorButton(); colorbutton.Height = lineWidth; colorbutton.Width = lineWidth; colorbutton.ClearButtonBorder.CornerRadius = new CornerRadius(100, 100, 100, 100); var originPoint = GetOriginPoint(); double x = originPoint.X - (lineWidth / 2); double y = originPoint.Y - (lineWidth / 2); Canvas.SetLeft(colorbutton, x); Canvas.SetTop(colorbutton, y); colorbutton.Color = new HsvColor(0, 0, (float)Brightness); return colorbutton; }
private ColorButton GenerateColorButton(double angle, double r) { double lineWidth = RSpan() - 3; ColorButton colorbutton = new ColorButton(); RotateTransform transform = new RotateTransform(angle); colorbutton.RenderTransform = transform; colorbutton.Height = lineWidth; colorbutton.Width = lineWidth; var originPoint = GetOriginPoint(); double x = Math.Cos(angle / 180 * Math.PI) * r + originPoint.X; double y = Math.Sin(angle / 180 * Math.PI) * r + originPoint.Y; Canvas.SetLeft(colorbutton, x); Canvas.SetTop(colorbutton, y); colorbutton.Color = GetColor(angle, r); return colorbutton; }