private void ColourBtn_Click(object sender, EventArgs e) { var btn = (Button)sender; if (ColourPicker.ShowDialog() == DialogResult.OK) { btn.BackColor = ColourPicker.Color; } }
private void BackColour_Clicked(object sender, RoutedEventArgs e) { ColourPicker picker = new ColourPicker(); if (picker.ShowDialog().IsFalse()) { return; } this.uxHtmlText.Selection.ApplyPropertyValue(TextElement.BackgroundProperty, picker.SelectedColour); }
private void BackColour_Clicked(object sender, RoutedEventArgs e) { if (this.selectedKey.IsNullEmptyOrWhiteSpace() || Formatters.GetVerseFromKey(this.selectedKey) <= 0) { MessageDisplay.Show("Please select a Verse"); return; } try { ColourPicker picker = new ColourPicker(); if (picker.ShowDialog().IsFalse()) { return; } int verseNumber = Formatters.GetVerseFromKey(this.selectedKey); HighlightRitchTextBox textBox = this.loadedTextBoxDictionary[verseNumber]; int start = textBox.GetSelectionStartIndex(); int length = textBox.GetSelectedTextLength(); textBox.HighlightText(start, length, picker.SelectedColour); string bibleVerseKey = Formatters.IsBiblesKey(this.selectedKey) ? this.selectedKey : $"{this.Bible.BibleId}||{this.selectedKey}"; BiblesData.Database.InsertVerseColour(bibleVerseKey, start, length, ColourConverters.GetHexFromBrush(picker.SelectedColour)); } catch (Exception err) { ErrorLog.ShowError(err); } }