private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { PickedColor.R = (short)RedSlider.Value; PickedColor.G = (short)GreenSlider.Value; PickedColor.B = (short)BlueSlider.Value; HxValueBlock.Text = PickedColor.AsHex(); ColorPickerPickedColor = PickedColor; if (PickedColor.IsLegal()) { ColorRectangle.Fill = new SolidColorBrush(PickedColor); RedTextBox.Background = GreenTextBox.Background = BlueTextBox.Background = SelectBG(PickedColor, ChosenProv?.province); } else { ColorRectangle.Fill = new SolidColorBrush(Colors.Transparent); RedTextBox.Background = LegalBG(PickedColor.R); GreenTextBox.Background = LegalBG(PickedColor.G); BlueTextBox.Background = LegalBG(PickedColor.B); } RedTextBox.ChannelTooltip(PickedColor.R); GreenTextBox.ChannelTooltip(PickedColor.G); BlueTextBox.ChannelTooltip(PickedColor.B); NewProvLegal(); }
void updateRGB() { R = TruncateFloat(red * 256, 0, 255); G = TruncateFloat(green * 256, 0, 255); B = TruncateFloat(blue * 256, 0, 255); RedTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); GreenTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); BlueTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); }
/// <summary> /// Make a shadow copy of the element at the current state which stays available even the element is gone. /// </summary> /// <returns>A shadow copy of the current element.</returns> public new BasicColorPickerDialogData GetDataCopy() { var data = new BasicColorPickerDialogData(); FillData(data); data.ColorsSection = GetSafeData(() => { if (ColorsSection == null) { return(null); } return(ColorsSection.GetDataCopy()); }); data.DefineColorsButton = GetSafeData(() => { if (DefineColorsButton == null) { return(null); } return(DefineColorsButton.GetDataCopy()); }); data.ColorPickSection = GetSafeData(() => { if (ColorPickSection == null) { return(null); } return(ColorPickSection.GetDataCopy()); }); data.ColorGradientSection = GetSafeData(() => { if (ColorGradientSection == null) { return(null); } return(ColorGradientSection.GetDataCopy()); }); data.ColorDisplaySection = GetSafeData(() => { if (ColorDisplaySection == null) { return(null); } return(ColorDisplaySection.GetDataCopy()); }); data.ColorShadeTextBox = GetSafeData(() => { if (ColorShadeTextBox == null) { return(null); } return(ColorShadeTextBox.GetDataCopy()); }); data.ColorChromaTextBox = GetSafeData(() => { if (ColorChromaTextBox == null) { return(null); } return(ColorChromaTextBox.GetDataCopy()); }); data.ColorBrightnessTextBox = GetSafeData(() => { if (ColorBrightnessTextBox == null) { return(null); } return(ColorBrightnessTextBox.GetDataCopy()); }); data.RedTextBox = GetSafeData(() => { if (RedTextBox == null) { return(null); } return(RedTextBox.GetDataCopy()); }); data.GreenTextBox = GetSafeData(() => { if (GreenTextBox == null) { return(null); } return(GreenTextBox.GetDataCopy()); }); data.BlueTextBox = GetSafeData(() => { if (BlueTextBox == null) { return(null); } return(BlueTextBox.GetDataCopy()); }); data.ApplyColorButton = GetSafeData(() => { if (ApplyColorButton == null) { return(null); } return(ApplyColorButton.GetDataCopy()); }); data.OKButton = GetSafeData(() => { if (OKButton == null) { return(null); } return(OKButton.GetDataCopy()); }); data.CancelButton = GetSafeData(() => { if (CancelButton == null) { return(null); } return(CancelButton.GetDataCopy()); }); data.HelpButton = GetSafeData(() => { if (HelpButton == null) { return(null); } return(HelpButton.GetDataCopy()); }); return(data); }
public SettingsPage() { SuspendLayout(); TBLayout.SuspendLayout(); ContentSettings.SuspendLayout(); ((ISupportInitialize)(BlueTrackBar)).BeginInit(); ((ISupportInitialize)(GreenTrackBar)).BeginInit(); ((ISupportInitialize)(RedTrackBar)).BeginInit(); Controls.Add(TBLayout); Controls.Add(ContentSettings); Name = "SettingsPage"; RedTextBox.AddColor1(); RedTextBox.ValueChanged += new EventHandler(RedChanged); GreenTextBox.AddColor1(); GreenTextBox.ValueChanged += new EventHandler(GreenChanged); BlueTextBox.AddColor1(); BlueTextBox.ValueChanged += new EventHandler(BlueChanged); ButtonAccept.AddColor1(); ButtonAccept.Click += new EventHandler(AcceptChange); ButtonCancel.AddColor1(); ButtonCancel.Click += new EventHandler(CancelChange); DefaultButton.AddColor1(); DefaultButton.Click += new EventHandler(ChangeDefault); BlueTrackBar.Scroll += new EventHandler(BlueTrack_Scroll); RedTrackBar.Scroll += new EventHandler(RedTrack_Scroll); GreenTrackBar.Scroll += new EventHandler(GreenTrack_Scroll); CheckToolTip.CheckedChanged += new EventHandler(SetCheckedToolTip); CheckEventLog.CheckedChanged += new EventHandler(SetCheckEventLog); DefaultButton.UseVisualStyleBackColor = false; // TBLayout TBLayout.ColumnCount = 3; TBLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); TBLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); TBLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); TBLayout.Controls.Add(ButtonCancel, 1, 0); TBLayout.Controls.Add(DefaultButton, 0, 0); TBLayout.Controls.Add(ButtonAccept, 2, 0); TBLayout.Location = new Point(58, 479); TBLayout.Margin = new Padding(0, 0, 0, 7); TBLayout.Name = "TBLayout"; TBLayout.RowCount = 1; TBLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); TBLayout.Size = new Size(422, 35); TBLayout.TabIndex = 1; // // ContentSettings ContentSettings.AutoScroll = true; ContentSettings.HorizontalScroll.Enabled = false; ContentSettings.Controls.Add(BlueTextBox); ContentSettings.Controls.Add(GreenTextBox); ContentSettings.Controls.Add(RedTextBox); ContentSettings.Controls.Add(BlueLabel); ContentSettings.Controls.Add(GreenLabel); ContentSettings.Controls.Add(RedLabel); ContentSettings.Controls.Add(BlueTrackBar); ContentSettings.Controls.Add(GreenTrackBar); ContentSettings.Controls.Add(RedTrackBar); ContentSettings.Controls.Add(EditColor); ContentSettings.Controls.Add(ColorDefault); ContentSettings.Controls.Add(TitleChangeColor); ContentSettings.Controls.Add(CheckToolTip); ContentSettings.Controls.Add(CheckEventLog); ContentSettings.Location = new Point(7, 7); ContentSettings.Margin = new Padding(7); ContentSettings.Name = "ContentSettings"; ContentSettings.Size = new Size(473, 465); ContentSettings.TabIndex = 0; ContentSettings.BackColor = RedGreenBlue.Color1; ResumeLayout(false); TBLayout.ResumeLayout(false); ContentSettings.ResumeLayout(false); ContentSettings.PerformLayout(); ((ISupportInitialize)(BlueTrackBar)).EndInit(); ((ISupportInitialize)(GreenTrackBar)).EndInit(); ((ISupportInitialize)(RedTrackBar)).EndInit(); }