Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made a control slider for brightness.

a.Change its ID to IDC_H_SLIDER_BAR
b.Orientation to Horizontal
c.Category to Control
d.Variable Name to m_HSliderBar
e.Variable Type to CSliderCtrl
f.Select the Messages button in main properties,Scroll down to WM_VSCROLL and click on "ADD OnVScroll"

What should I do next, please reply.
Posted
Updated 9-Jun-10 22:56pm
v2

1 solution

Add a variable of type int for your slider to get easy access to its value.

in header for you dialog
public:
    int GetBrightness() const { return m_sliderValue; }
    void SetBrightness(int brightness) { m_sliderValue = brightness; }
protected:
    int m_sliderValue; // Value added for control


For simple tasks you don't need an event handler.

Notice that you will get something like
DDX_Slider(pDX, IDC_H_SLIDER_BAR, m_sliderValue);


in your DoDataExchange function. It will take care of transferring the controls value to your member variable.

For more reading you can check out UpdateData() in the SDK.

You will only need an event handler if you plan on having a preview of your brightness value.

Also, you want to set the range for your slider from your OnInitDialog() method.

m_HSliderBar.SetRange(0, 100);
 
Share this answer
 
v2
Comments
Sweety Khan 19-Jun-10 4:17am    
every thing is done but i give range like this
slider.SetRangeMin(0, false);
slider.SetRangeMax(9, false);
but it still shows from 0-100 when i move slider.

waiting for ur reply........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900