Oleg's profileOleg V. Polikarpotchkin ...BlogNetwork Tools Help

Blog


    June 08

    ColorSaturationBox Element

    This element is one more control from the ColorPicker constituent controls bug in addition to ones published in my recent posts.

    ColorSaturationBox element is designed as the tool to select a Color from the mix of some Color with the White and Black colors. It extends the FrameworkElement. The idea of this element is borrowed from the Uncommon Dialogs: Font Chooser & Color Picker Dialogs article.

    The color surface to select color from is the superposition of some color gradients. Roughly it consists of

    1. Vertical BaseColor-Black gradient.
    2. Vertical White-Black gradient with Horizontal Opacity mask gradient.

    BaseColor is the variable reference color you can get or set with the BaseColor Dependency Property.

    That is the sample.

    ColorSaturationBox

    The ColorSaturationBox element is at the top-left window corner. At right of it is the RainbowSlider (see here) used to select the value of BaseColor. The SelectedColor sample is at the right-top corner. Below it the SelectedColor components are displayed in numbers.

    You select the color with the color selector (small white circle with black border). You can drag it with the mouse or just click anywhere on the ColorSaturationBox element surface. A propos, you can provide you own color selector drawing with the ColorSaturationBox.Selector Dependency Property.

    Read-only ColorSaturationBox.SelectedColor Dependency Property used to get the value of the Color selected. User can change the SelectedColor property from its code using the SelectorPosition property. The SelectorPosition property gets or sets the selector position normalized to [0,1 0,1] rectangle. When the SelectedColor changes the ColorSaturationBox raises the SelectedColorChanged event.

    The code

    You can download the code and the samples here:


    The archive contains my WPFGears library with samples, tests, etc. It’s the Visual Studio 2008 SP1 solution targeted to .NET Framework 3.5.

    You’ll find ColorSaturationSample project there. ColorSaturationBox element code is in the WPFGears library project ColorPickerControls folder.

    Regards,
    Oleg V. Polikarpotchkin

    Technorati Теги: ,,

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://ov-p.spaces.live.com/blog/cns!39D56F0C7A08D703!292.trak
    Weblogs that reference this entry
    • None