在其上显示数字的滑块控件 [英] Slider Control with Numbers displaying over it

查看:120
本文介绍了在其上显示数字的滑块控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个可滚动的滑块,上面显示数字.我已经附上了我所需的示例滑块的链接.

https://rapidshare.com/files/2605350808/SampleSlider.jpg [解决方案

自定义滚动条不是很容易.此链接将有助于准备自定义滚动条.它说明了鼠标消息的处理,控件的绘制,键盘交互和成比例的拇指滑块.
http://www.drdobbs.com/windows/developing- a-custom-windows-scrollbar-in/184416659?pgno = 1

我想准备一个控件需要执行以下步骤,类似于您附带的图像.
1)绘制渐变背景.
2)文本值的背景;需要考虑从black(325)的过渡.灰色(450)>黑色(600).
3)需要以不同的渐变绘制文本.
关于每种文本的颜色,需要从左到中心增加每种成分的强度(R,G,B).
例如,将使用RGB(50,50,50)绘制值325,然后稍微增加350的颜色,例如说RGB(75,75,75),例如增加下一个值的颜色,并使用RGB(255,255,255)绘制450 ).
从450到600,您必须降低每种成分(R,G,B)的强度.
4)绘制拇指滑块,您必须为拇指滑块应用透明度. AlphaBlend()将有助于在背景值上创建缩略图的透明效果.
您可以忽略向左和向右滚动箭头的绘制.

Hi i need to create a scrollable slider with numbers displaying over it. I had attached the link for sample slider i needed.

https://rapidshare.com/files/2605350808/SampleSlider.jpg[^]

解决方案

Preparing a custom scroll bar is not much easy. This link will help to prepare a custom scroll bar. It explains the handling of mouse messages, drawing of the control, keyboard interaction and proportional thumb slider.
http://www.drdobbs.com/windows/developing-a-custom-windows-scrollbar-in/184416659?pgno=1

I suppose the following steps are required to prepare a control, similar to your attached image.
1) Draw a gradient background.
2) Background of text values; Need to consider the transition from black(325) > gray(450) > black(600).
3) Need to draw the text in different gradient.
Regarding color of each text, Need to increase the intensity of each component(R,G,B) from Left to Center.
ie value 325 will be drawn with RGB(50,50,50) then color of 350 is slightly increased, say RGB(75,75,75) like that color of next values are incremented and 450 will be drawn by color RGB(255,255,255).
From 450 to 600, you have to decrease the intensity of each component(R,G,B).
4) Draw thumb slider, You have to apply transparency for the thumb slider. AlphaBlend() will be helpful to create a transparent effect of thumbnail over the background values.
You can ignore the drawing of left and right scroll arrows..


这篇关于在其上显示数字的滑块控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆