本文整理汇总了C#中System.Windows.Forms.TrackBar.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# TrackBar.Invoke方法的具体用法?C# TrackBar.Invoke怎么用?C# TrackBar.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TrackBar
的用法示例。
在下文中一共展示了TrackBar.Invoke方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTrackBarValue
/// <summary>
/// Sets value of a tackbar as an integer
/// Takes care of cross-thread invokations that would result in
/// .NET exceptions
/// </summary>
/// <param name="trackBar"></param>
/// <param name="positionValue"></param>
public static void SetTrackBarValue(TrackBar trackBar, int positionValue)
{
if (trackBar.InvokeRequired)
{
trackBar.Invoke(new setTrackBarValue(SetTrackBarValue), trackBar, positionValue);
}
else
{
if ((positionValue <= trackBar.Maximum) && (positionValue >= trackBar.Minimum))
{
trackBar.Value = positionValue;
}
else
{
Log.Debug("Trying to set trackbar outside legal bounds!");
}
}
}
示例2: GetTrackBarValueInt
/// <summary>
/// Returns trackbar value
/// Takes care of cross-thread invokations that would result in
/// .NET exceptions
/// </summary>
/// <param name="trackBar">the trackbar object</param>
/// <returns>position</returns>
public static int GetTrackBarValueInt(TrackBar trackBar)
{
if (trackBar.InvokeRequired)
{
return (int)trackBar.Invoke(new getTrackBarValueInt(GetTrackBarValueInt), trackBar);
}
return trackBar.Value;
}
示例3: GetSliderValue
private int GetSliderValue(TrackBar Control)
{
if (Control.InvokeRequired)
{
try
{
return (int)Control.Invoke(new Func<int>(() => GetSliderValue(Control)));
}
catch
{
return 0;
}
}
else
{
return Control.Value;
}
}