winForm如何在右下角弹出窗体???? 弹出的窗体在最上面,并且不获得焦点 ,就是不影响其他节面的操作 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不可能啊 你说的web中的div吧 窗体如果你点击别的就自动跑到获得焦点窗体的下面了 如果一直在最上面就用showdilog 但是这种方法 显示的窗体必须关闭 其他窗体才能获得焦点 winFrom右下角弹出消息,自动消失 这个是可以做的 /// <summary> /// 枚举,描述消息窗口加载的形式 /// </summary> public enum LoadMode { /// <summary> /// 警告 /// </summary> Warning, /// <summary> /// 错误 /// </summary> Error, /// <summary> /// 提示 /// </summary> Prompt } /// <summary> /// 消息提示窗口 /// </summary> public partial class FormMessageBox : Form { /// <summary> /// 构造方法 /// </summary> public FormMessageBox() { InitializeComponent(); } #region ***********************字 段*********************** /// <summary> /// 窗体加载模式 /// </summary> private static LoadMode FormMode = LoadMode.Prompt; /// <summary> /// 显示的消息正文 /// </summary> private static string ShowMessage = null; /// <summary> /// 关闭窗口的定时器 /// </summary> private Timer Timer_Close = new Timer(); [DllImportAttribute("user32.dll")] private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); // 该函数可以实现窗体的动画效果 public const Int32 AW_HOR_POSITIVE = 0x00000001; // 自左向右显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略 public const Int32 AW_HOR_NEGATIVE = 0x00000002; // 自右向左显示窗口。当使用了 AW_CENTER 标志时该标志被忽略 public const Int32 AW_VER_POSITIVE = 0x00000004; // 自顶向下显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略 public const Int32 AW_VER_NEGATIVE = 0x00000008; // 自下向上显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略 public const Int32 AW_CENTER = 0x00000010; // 若使用了AW_HIDE标志,则使窗口向内重叠;若未使用AW_HIDE标志,则使窗口向外扩展 public const Int32 AW_HIDE = 0x00010000; // 隐藏窗口,缺省则显示窗口 public const Int32 AW_ACTIVATE = 0x00020000; // 激活窗口。在使用了AW_HIDE标志后不要使用这个标志 public const Int32 AW_SLIDE = 0x00040000; // 使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略 public const Int32 AW_BLEND = 0x00080000; // 使用淡入效果。只有当hWnd为顶层窗口的时候才可以使用此标志 #endregion************************************************* #region ***********************方 法*********************** /// <summary> /// 构造方法 /// </summary> /// <param name="loadMode">加载模式</param> /// <param name="message">消息正文</param> public static void Show(LoadMode loadMode, string message) { FormMode = loadMode; ShowMessage = message; FormMessageBox box = new FormMessageBox(); box.Show(); } #endregion************************************************* #region ***********************事 件*********************** /// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMessageBox_Load(object sender, EventArgs e) { this.lblTitle.Text = "提示"; if (FormMode == LoadMode.Error) { this.lblTitle.Text = "错误"; this.plShow.BackgroundImage = global::dataSource.Properties.Resources.error; // 更换背景 } else if (FormMode == LoadMode.Warning) { this.lblTitle.Text = "警告"; this.plShow.BackgroundImage = global::dataSource.Properties.Resources.warning; // 更换背景 } else { this.plShow.BackgroundImage = global::dataSource.Properties.Resources.Prompt; // 更换背景 } this.lblMessage.Text = ShowMessage; int width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; int height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; int top = height - 35 - this.Height; int left = width - this.Width - 5; this.Top = top; this.Left = left; this.TopMost = true; AnimateWindow(this.Handle, 500, AW_SLIDE + AW_VER_NEGATIVE);//开始窗体动画 this.ShowInTaskbar = false; Timer_Close.Interval = 4000; Timer_Close.Tick += new EventHandler(Timer_Close_Tick); Timer_Close.Start(); } /// <summary> /// 关闭窗口的定时器响应事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Timer_Close_Tick(object sender, EventArgs e) { Timer_Close.Stop(); this.Close(); } /// <summary> /// 窗口已经关闭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMessageBox_FormClosed(object sender, FormClosedEventArgs e) { AnimateWindow(this.Handle, 500, AW_SLIDE + AW_VER_POSITIVE + AW_HIDE); Timer_Close.Stop(); Timer_Close.Dispose(); } /// <summary> /// 鼠标移动在消息框上 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void plShow_MouseMove(object sender, MouseEventArgs e) { this.Timer_Close.Stop(); } /// <summary> /// 鼠标移动离开消息框上 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void plShow_MouseLeave(object sender, EventArgs e) { this.Timer_Close.Start(); } 这个功能很多管理系统都用得到,http://wenku.baidu.com/view/c1ad1227482fb4daa58d4bfe.htmlwinform C#屏幕右下角弹出消息框,自动消失 C#如何判断磁盘正在被写入? 请教:关于C#用户权限分配问题!!! 【急求】一个简单的上传图片及显示问题,谢 asp.net问题 求高手指点 语法性能疑问 新手提问.c#程序。pageload如果满足判断条件就打开新窗体,并传参数给新窗体,如果不满足就提示错误。高手给个实例好么,谢谢了,在线等 WPF里的MouseDown事件对左键按下不响应? 子类继承父类 刚学习Remoting,出问题了,高人进来说两句 收集2G多的电子书,免费提供 如何让控件的text换行(ps:不用代码实现) 使用C#编写一个操作系统 编辑后的界面部分按键处于无法使用的状态
/// <summary>
/// 枚举,描述消息窗口加载的形式
/// </summary>
public enum LoadMode
{
/// <summary>
/// 警告
/// </summary>
Warning, /// <summary>
/// 错误
/// </summary>
Error, /// <summary>
/// 提示
/// </summary>
Prompt
} /// <summary>
/// 消息提示窗口
/// </summary>
public partial class FormMessageBox : Form
{
/// <summary>
/// 构造方法
/// </summary>
public FormMessageBox()
{
InitializeComponent();
}
#region ***********************字 段*********************** /// <summary>
/// 窗体加载模式
/// </summary>
private static LoadMode FormMode = LoadMode.Prompt; /// <summary>
/// 显示的消息正文
/// </summary>
private static string ShowMessage = null; /// <summary>
/// 关闭窗口的定时器
/// </summary>
private Timer Timer_Close = new Timer();
[DllImportAttribute("user32.dll")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); // 该函数可以实现窗体的动画效果 public const Int32 AW_HOR_POSITIVE = 0x00000001; // 自左向右显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略
public const Int32 AW_HOR_NEGATIVE = 0x00000002; // 自右向左显示窗口。当使用了 AW_CENTER 标志时该标志被忽略 public const Int32 AW_VER_POSITIVE = 0x00000004; // 自顶向下显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略
public const Int32 AW_VER_NEGATIVE = 0x00000008; // 自下向上显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略 public const Int32 AW_CENTER = 0x00000010; // 若使用了AW_HIDE标志,则使窗口向内重叠;若未使用AW_HIDE标志,则使窗口向外扩展
public const Int32 AW_HIDE = 0x00010000; // 隐藏窗口,缺省则显示窗口
public const Int32 AW_ACTIVATE = 0x00020000; // 激活窗口。在使用了AW_HIDE标志后不要使用这个标志
public const Int32 AW_SLIDE = 0x00040000; // 使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略
public const Int32 AW_BLEND = 0x00080000; // 使用淡入效果。只有当hWnd为顶层窗口的时候才可以使用此标志 #endregion*************************************************
#region ***********************方 法*********************** /// <summary>
/// 构造方法
/// </summary>
/// <param name="loadMode">加载模式</param>
/// <param name="message">消息正文</param> public static void Show(LoadMode loadMode, string message)
{
FormMode = loadMode;
ShowMessage = message; FormMessageBox box = new FormMessageBox();
box.Show();
} #endregion*************************************************
#region ***********************事 件*********************** /// <summary>
/// 窗体加载事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormMessageBox_Load(object sender, EventArgs e)
{
this.lblTitle.Text = "提示";
if (FormMode == LoadMode.Error)
{
this.lblTitle.Text = "错误";
this.plShow.BackgroundImage = global::dataSource.Properties.Resources.error; // 更换背景
}
else if (FormMode == LoadMode.Warning)
{
this.lblTitle.Text = "警告";
this.plShow.BackgroundImage = global::dataSource.Properties.Resources.warning; // 更换背景
}
else
{
this.plShow.BackgroundImage = global::dataSource.Properties.Resources.Prompt; // 更换背景
} this.lblMessage.Text = ShowMessage; int width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
int height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
int top = height - 35 - this.Height;
int left = width - this.Width - 5;
this.Top = top;
this.Left = left;
this.TopMost = true; AnimateWindow(this.Handle, 500, AW_SLIDE + AW_VER_NEGATIVE);//开始窗体动画 this.ShowInTaskbar = false; Timer_Close.Interval = 4000;
Timer_Close.Tick += new EventHandler(Timer_Close_Tick);
Timer_Close.Start();
} /// <summary>
/// 关闭窗口的定时器响应事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Timer_Close_Tick(object sender, EventArgs e)
{
Timer_Close.Stop(); this.Close();
} /// <summary>
/// 窗口已经关闭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormMessageBox_FormClosed(object sender, FormClosedEventArgs e)
{
AnimateWindow(this.Handle, 500, AW_SLIDE + AW_VER_POSITIVE + AW_HIDE); Timer_Close.Stop();
Timer_Close.Dispose();
} /// <summary>
/// 鼠标移动在消息框上
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void plShow_MouseMove(object sender, MouseEventArgs e)
{
this.Timer_Close.Stop();
} /// <summary>
/// 鼠标移动离开消息框上
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void plShow_MouseLeave(object sender, EventArgs e)
{
this.Timer_Close.Start();
}
http://wenku.baidu.com/view/c1ad1227482fb4daa58d4bfe.html
winform C#屏幕右下角弹出消息框,自动消失