改变轨迹条拇指的背景
本文关键字:背景 轨迹 改变 | 更新日期: 2023-09-27 18:11:11
有办法改变Trackbar拇指的背景吗?我使用c# winform。
只有Trackbar的背景可以更改,那么我如何在拇指中更改或设置一些东西呢?
我看到了这个项目:
http://www.codeproject.com/Articles/7974/A-variation-on-the-default-TrackBar并添加它的图片,让用户选择:
/// <summary>
/// Set Image of Trackbar's thumb
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[Description("Set the picture of the thumb")]
[Category("Image")]
public Image Picture
{
set
{
myPic = value;
}
get { return myPic; }
}
并使用TextureBrush让图片People选择为ImageBrush:
TextureBrush newBrush = new TextureBrush(myPic);
if (myPic != null)
{
g.FillRegion(newBrush, new Region(PaintPath));
newBrush.Dispose();
}
else
{
g.FillRegion(bgBrush, new Region(PaintPath));
bgBrush.Dispose();
}
只有一个问题,imagebrush是平铺样式,
如果我让它不是一个平铺样式,它可能解决我的问题。