分类: C# 2011-11-17 13:30 60人阅读 评论(0) 收藏 举报
/// <summary>
/// 强制恢复当前控件和所有父控件的正常的布局逻辑
/// </summary>
/// <param name="uc"></param>
private void SetParentDockStype(Control uc)孟瑶的胸
{
uc.Dock = DockStyle.Fill;
uc.ResumeLayout(true);
if (uc.Parent != null)
{
SetParentDockStype(uc.Parent);
}
}
}
}
分享到:
VS2005中C#如何实现在加载大量数据的时候显示“正在加载,请稍等......" 的窗体,数据加载完后此窗体关闭,然后再打开登录窗体.假设“正在加载,请稍等......" 的窗体名为PreFrm,登录窗体名为LoginFrm,大家能够提供多线程或者异步解决的方法吗?
我很少用线程,异步东东,不允许用简单的PreFrm.show()和PreFrm.close()来解决.
说明:LoginFrm窗体数据绑定完之前都只显示PreFrm窗体,等LoginFrm窗体数据绑定完之后,PreFrm窗体关闭,LoginFrm窗体打开.
我很少用线程,异步东东,不允许用简单的PreFrm.show()和PreFrm.close()来解决.
说明:LoginFrm窗体数据绑定完之前都只显示PreFrm窗体,等LoginFrm窗体数据绑定完之后,PreFrm窗体关闭,LoginFrm窗体打开.
Thread th;
public void str()
{
public void str()
{
//form2是你要显示的加载窗口
PreFrm frm = new PreFrm();
frm.ShowDialog();
}
private void LoginFrm_Load(object sender, EventArgs e)
{
th = new Thread(new ThreadStart(str));
th.Start();
//这里写你要加载数据的CODE
th.Abort();
}
PreFrm frm = new PreFrm();
frm.ShowDialog();
}
private void LoginFrm_Load(object sender, EventArgs e)
{
th = new Thread(new ThreadStart(str));
th.Start();
//这里写你要加载数据的CODE
th.Abort();
}
/// <summary>
/// </summary>
/// <param name="obj"></param>
public delegate void ExecutiveFunction(object obj);
//线程消息回调方法委托。
private delegate void InvokeFunction0();
private delegate void InvokeFunction1(object obj);
private string _str = "·";
private string _caption = "正在执行";
private ExecutiveFunction _executiveFunction = null;
private Thread _thread = null;
private bool _isAlreadyStart = false;
private bool _isStartWhenShow = true;
private bool _isUserThread = false;
private object _currentData = null;
private bool _isInit = false;
#region 构造函数。最浪漫的签名
/// <summary>
/// 进度显示窗口。
/// </summary>
/// <param name="function">需要执行的方法。</param>
/// <param name="obj">要执行的方法参数。</param>
public Progress(ExecutiveFunction function, object obj)
{
InitializeComponent();
this._currentData = obj;
this._executiveFunction = function;
this.cB_AutoClose.Checked = true;
this.cB_AutoClose.Visible = false;
this.btn_Cancel.Visible = false;
this.ControlBox = false;
this.timer1.Start();
if (cB_AutoClose.Checked == true)
{
_isInit = true;
}
}
/// <summary>
/// 进度显示窗口。
/// </summary>
/// <param name="function">需要执行的方法。</param>
/// <param name="obj">要执行的方法参数。</param>
/// <param name="isUserThread">是否在线程中执行。</param>
/// <param name="isStartWhenShow">是否窗体显示时自动开始执行。</param>
public Progress(ExecutiveFunction function, object obj, bool isUserThread, bool isStartWhenShow)
{
InitializeComponent();
this._currentData = obj;
this._isStartWhenShow = isStartWhenShow;
this._isUserThread = isUserThread;
this._executiveFunction = function;
if (!isUserThread)
{
this.cB_AutoClose.Checked = true;
this.cB_AutoClose.Visible = false;
this.btn_Cancel.Visible = false;
this.ControlBox = false;
}
this.timer1.Start();
_isInit = true;
}
qq被冻结了怎么样才可以解冻
/// <summary>
/// 进度显示窗口。
/// </summary> 大学生年度自我鉴定
/// <param name="function">需要执行的方法。</param>
/// <param name="obj">要执行的方法参数。</param>
/// <param name="isUserThread">是否在线程中执行。</param>
描写雨的段落 /// <param name="isStartWhenShow">是否窗体显示时自动开始执行。</param>
/// <param name="isShowAutoClose">是否显示用户取消按钮,当非线程执行时该参数无效,默认为false。</param>
public Progress(ExecutiveFunction function, object obj, bool isUserThread, bool isStartWhenShow, bool isShowAutoClose)
{
InitializeComponent();
this._currentData = obj;
this._isStartWhenShow = isStartWhenShow;
this._isUserThread = isUserThread;
this._executiveFunction = function;
if (!isUserThread || !isShowAutoClose)
{
this.cB_AutoClose.Checked = true;
this.cB_AutoClose.Visible = false;
this.btn_Cancel.Visible = false;
this.ControlBox = false;
发布评论