winform的新闻滚动条小问题?

siemans 2008-10-30 04:38:10
我做了个没边框的winform ,下面这俩个问题要怎么实现:
1)双击这个winform 让它最小化到桌面右下角,也就是时间显示栏上,要怎么实现?
2)右键单击这个winform 要出现一个小菜单,比如上面有“制作”,“关闭”等,要怎么实现?
...全文
139 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
萤火架构 2008-10-30
  • 打赏
  • 举报
回复
ContextMenuStrip控件

this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.CloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ShowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.CloseToolStripMenuItem,
this.ShowToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(100, 48);
//
// CloseToolStripMenuItem
//
this.CloseToolStripMenuItem.Name = "CloseToolStripMenuItem";
this.CloseToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.CloseToolStripMenuItem.Text = "Close";
this.CloseToolStripMenuItem.Click += new System.EventHandler(this.CloseToolStripMenuItem_Click);
//
// ShowToolStripMenuItem
//
this.ShowToolStripMenuItem.Name = "ShowToolStripMenuItem";
this.ShowToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.ShowToolStripMenuItem.Text = "Show";
this.ShowToolStripMenuItem.Click += new System.EventHandler(this.ShowToolStripMenuItem_Click);

this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;

private void CloseToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}

private void ShowToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Show();
}
萤火架构 2008-10-30
  • 打赏
  • 举报
回复
NotifyIcon控件

private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
this.Show();
}

private void Form5_DoubleClick(object sender, EventArgs e)
{
this.Hide();
}

public const int WM_NCLBUTTONDBLCLK = 0xA3;

protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCLBUTTONDBLCLK)
{
this.Hide();
return;
}
base.WndProc(ref m);
}
nhscorpio 2008-10-30
  • 打赏
  • 举报
回复
共同学习
wxm3630478 2008-10-30
  • 打赏
  • 举报
回复
图标自己找一个http://www.bitbug.net/制作ICO格式图片的网站
wxm3630478 2008-10-30
  • 打赏
  • 举报
回复
vs2005中 很好办

拖一个NotifyIcon控件和contextmenustrip控件 

contextmenustrip控件绑定给NotifyIcon控件

就搞定
Jack_He 2008-10-30
  • 打赏
  • 举报
回复
学习了,但是我尝试了不少办法,没让它重新显示出来。
mykelly6 2008-10-30
  • 打赏
  • 举报
回复
菜单用contextmenustrip比如叫"rightKeyMenu",然后把这个"rightKeyMenu"设置给界面所在控件的contextmenustrip属性~~
止戈而立 2008-10-30
  • 打赏
  • 举报
回复
加个NotifyIcon控件。。
1、你没有边框,在哪里双击?如果双击界面,那就写界面的双击事件就OK了。。
this.Hide();
notifyIcon1.Visible=true;
2、写界面的右键事件,弹出一个菜单控件。。这样就行了。

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧