在wpf里面怎么动态的移动lable控件,求大神指教,最好有代码。
1条回答
- threenewbee 2014-12-02 18:59关注
public static class DispatcherHelper
{
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public static void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrames), frame);
try { Dispatcher.PushFrame(frame); }
catch (InvalidOperationException) { }
}
private static object ExitFrames(object frame)
{
((DispatcherFrame)frame).Continue = false;
return null;
}
}调用
for (int i = 1; i < 10; i++)
{
System.Threading.Thread.Sleep(100);
DispatcherHelper.DoEvents();
label1.Left += 10;
}解决 无用评论 打赏 举报
悬赏问题
- ¥15 vhdl+MODELSIM
- ¥20 simulink中怎么使用solve函数?
- ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
- ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
- ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
- ¥15 知识蒸馏实战博客问题
- ¥15 用PLC设计纸袋糊底机送料系统
- ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
- ¥15 用C语言输入方程怎么
- ¥15 网站显示不安全连接问题