RGB Color Picker With C#'s WPF

In this article we create WPF app. It uses RGB colors affects. It contains a few features. We can start with Action keyword. This keyword provide display the changes. Normaly we use event handler to keep this type events. As you will see the following code color values increase or decrease 5 by 5.
        public Action changedRGB;
        protected virtual void OnValueChanged() => changedRGB?.Invoke();  
        
        private void IncreaseValue(object o, EventArgs e)
        {
            Button button = (Button)o;
            switch (button.Name)
            {
                case "btnRed":
                    rGB.R += 5;
                    r=rGB.R;
                    lbRed.Content = r.ToString();
                    break;
                case "btnGreen":
                    rGB.G += 5;
                    g=rGB.G;
                    lbGreen.Content=g.ToString();
                    break;
                case "btnBlue":
                    rGB.B += 5;
                    b=rGB.B;
                    lbBlue.Content=b.ToString();
                    break;
            }
            OnValueChanged();
            changedRGB += ColorPicker;
        }
You can see the whole project on RGB-Colors-In-WPF page. As continous above codes I wanna show followin code sample.

If we run this:

Comments

Popular posts from this blog

Tech Duos For Web Development

CIFAR-10 Dataset Classification Using Convolutional Neural Networks (CNNs) With PyTorch

Long-short-term-memory (LSTM) Word Prediction With PyTorch