vs2005,想用winfrom实现右下角的弹窗,类似QQ消息是的 本身有个登陆窗体。然后比如现在有信息来了然后在右下角给弹出个提示框。想问下怎么写 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 获取屏幕的分辨率,之后计算你窗体的location让他在你想显示的地方显示 http://www.crifan.com/csharp_add_tip_windows_right_coner_for_open_file_and_folder/这个应该可以 这个可以获取分辨率//这个区域不包括任务栏的Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this);//这个区域包括任务栏,就是屏幕显示的物理范围Rectangle ScreenArea = System.Windows.Forms.Screen.GetBounds(this);int width1 = ScreenArea.Width; //屏幕宽度 int height1 = ScreenArea.Height; //屏幕高度this.Location = new System.Drawing.Point(width1 - 窗体宽度, height1 - 窗体高度); //指定窗体显示在右下角至于退出的时候渐隐可以采用更改透明度实现动态更改form的Opacity值。当然这里你必须要使用定时器timer来实现 用jquery 相关UI就可以实现了。/// <summary> /// EasyUI 右下角提示框 /// </summary> /// <param name="msg">提示内容</param> public static void ShowMessage(string msg) { string scriptStr = "<script language='javascript'>$(function () { $.messager.show({ title : '提示' , msg : '@msg'}); });</script>"; scriptStr = scriptStr.Replace("@msg", msg); Page p = (Page)System.Web.HttpContext.Current.Handler; p.ClientScript.RegisterStartupScript(p.GetType() , "message" , scriptStr); }调用ShowMessage("操作成功!");前提是你需要引入一个EasyUI插件和JQUEY 看错了,以为是需要类似winform的弹窗效果。 winform就更好做了。public class MyButton : System.Windows.Forms.Button { public bool Selectable { get { return this.GetStyle(System.Windows.Forms.ControlStyles.FixedHeight); } set { this.SetStyle(System.Windows.Forms.ControlStyles.Selectable, value); } } } //提示窗口代码: public partial class MsgForm : Form { public MsgForm() { InitializeComponent(); } //设置提示信息 public void SetMessage(string Msg) { lblMsg.Text = Msg; } private void MsgForm_Load(object sender, EventArgs e) { //让按钮无焦点框 btnOK.Selectable = false; btnCancel.Selectable = false; } //关闭窗口 private void btnClose_Click(object sender, EventArgs e) { this.Close(); } //给窗口画个边框 private void MsgForm_Paint(object sender, PaintEventArgs e) { Graphics grpForm=e.Graphics; Pen pen = new Pen(Color.FromArgb(175, 210, 255), 1.0f); grpForm.DrawRectangle(pen,0,0,this.Width-1,this.Height-1); } } //使用提示窗口的代码: private MsgForm m_frmMsg = null; //提示窗口 //显示提示窗口 public void ShowLoadAlert(string Msg) { bool isExist = false; Point pos = new Point(0, 0); if (m_frmMsg != null && (!m_frmMsg.IsDisposed)) { isExist = true; pos = m_frmMsg.Location; } m_frmMsg = new MsgForm(); Rectangle r = Screen.GetWorkingArea(this); //定位于右下角 m_frmMsg.Location = new Point(r.Right - m_frmMsg.Width, r.Bottom - m_frmMsg.Height); if (isExist) { //如果前面有提示窗口,则将定位于其上面 if ((pos.Y - m_frmMsg.Height) > 0) m_frmMsg.Location = new Point(r.Right - m_frmMsg.Width, pos.Y - m_frmMsg.Height); } m_frmMsg.SetMessage(Msg); m_frmMsg.Show(); } 我想你用该用System.Windows.Forms.NotifyIcon;对象 您这这短代码我直接新建个from窗体能直接复制过来用么? 这里有源码http://download.csdn.net/detail/wangshiwei1105/2618618一个窗体 一个背景图 一个按钮 一个Label 要分呀兄弟。能给我个不要分的么。或者能给我邮箱传一个么。[email protected]谢谢拜托了 C#如何使用https向exe程序发送消息 C#登陆提示 如何创建 Interop.System.Management.dll 获得数组中元素的个数? dr.GetString(i)有没有通用类型或怎么转换成string? 请问如何在一个窗体中获得另一个窗体中的控件的属性 关于一个post 请求对应https 网站 大家用过票据打印机吗??如何使用打印机的打印控制命令啊??? 我想把数据库中的一张表导入到datagridview中为什么老是实现不了 如何利用WMI捕获网卡移除的消息 C#调用自己写的C程序 winform 报错:此操作对事务的状态无效
这个应该可以
//这个区域不包括任务栏的Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this);
//这个区域包括任务栏,就是屏幕显示的物理范围Rectangle ScreenArea = System.Windows.Forms.Screen.GetBounds(this);int width1 = ScreenArea.Width; //屏幕宽度
int height1 = ScreenArea.Height; //屏幕高度
this.Location = new System.Drawing.Point(width1 - 窗体宽度, height1 - 窗体高度); //指定窗体显示在右下角至于退出的时候渐隐可以采用更改透明度实现
动态更改form的Opacity值。当然这里你必须要使用定时器timer来实现
/// EasyUI 右下角提示框
/// </summary>
/// <param name="msg">提示内容</param>
public static void ShowMessage(string msg)
{
string scriptStr = "<script language='javascript'>$(function () { $.messager.show({ title : '提示' , msg : '@msg'}); });</script>";
scriptStr = scriptStr.Replace("@msg", msg);
Page p = (Page)System.Web.HttpContext.Current.Handler;
p.ClientScript.RegisterStartupScript(p.GetType()
, "message"
, scriptStr);
}
调用
ShowMessage("操作成功!");前提是你需要引入一个EasyUI插件和JQUEY
public class MyButton : System.Windows.Forms.Button
{
public bool Selectable
{
get { return this.GetStyle(System.Windows.Forms.ControlStyles.FixedHeight); }
set { this.SetStyle(System.Windows.Forms.ControlStyles.Selectable, value); }
}
} //提示窗口代码:
public partial class MsgForm : Form
{
public MsgForm()
{
InitializeComponent();
}
//设置提示信息
public void SetMessage(string Msg)
{
lblMsg.Text = Msg;
}
private void MsgForm_Load(object sender, EventArgs e)
{
//让按钮无焦点框
btnOK.Selectable = false;
btnCancel.Selectable = false;
}
//关闭窗口
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
//给窗口画个边框
private void MsgForm_Paint(object sender, PaintEventArgs e)
{
Graphics grpForm=e.Graphics;
Pen pen = new Pen(Color.FromArgb(175, 210, 255), 1.0f);
grpForm.DrawRectangle(pen,0,0,this.Width-1,this.Height-1);
}
}
//使用提示窗口的代码:
private MsgForm m_frmMsg = null;
//提示窗口
//显示提示窗口
public void ShowLoadAlert(string Msg)
{
bool isExist = false;
Point pos = new Point(0, 0);
if (m_frmMsg != null && (!m_frmMsg.IsDisposed))
{
isExist = true;
pos = m_frmMsg.Location;
}
m_frmMsg = new MsgForm();
Rectangle r = Screen.GetWorkingArea(this);
//定位于右下角
m_frmMsg.Location = new Point(r.Right - m_frmMsg.Width, r.Bottom - m_frmMsg.Height);
if (isExist)
{
//如果前面有提示窗口,则将定位于其上面
if ((pos.Y - m_frmMsg.Height) > 0)
m_frmMsg.Location = new Point(r.Right - m_frmMsg.Width, pos.Y - m_frmMsg.Height);
}
m_frmMsg.SetMessage(Msg);
m_frmMsg.Show();
}
http://download.csdn.net/detail/wangshiwei1105/2618618
一个窗体 一个背景图 一个按钮 一个Label