| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6045 人关注过本帖
标题:如何把程序最小化到任务栏最右边,变成一个小图标??
只看楼主 加入收藏
Enoch
Rank: 1
等 级:新手上路
帖 子:55
专家分:0
注 册:2006-4-26
收藏
 问题点数:0 回复次数:12 
如何把程序最小化到任务栏最右边,变成一个小图标??
请问如何把程序最小化到任务栏最右边,变成一个小图标??还有,如何实现:数据库更新了就会弹出一个小提示,让我们知道数据库更新了???谢谢大家帮忙!
搜索更多相关主题的帖子: 任务栏 程序最小 数据库 图标 提示 
2006-05-24 10:18
wangfuli
Rank: 4
等 级:贵宾
威 望:12
帖 子:206
专家分:10
注 册:2005-11-11
收藏
得分:0 

用NotifyIcon1就可以了,具体的你自己查查msdn就可以了


2006-05-24 10:21
Enoch
Rank: 1
等 级:新手上路
帖 子:55
专家分:0
注 册:2006-4-26
收藏
得分:0 
我看过了,谢谢,那能不能让程序最小化之后的图标闪烁??

2006-05-24 11:55
chen5322
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2006-5-25
收藏
得分:0 

用2个不同的图片,再使用TIMER控件使2个图片进行切换就行

2006-05-26 02:09
chen5322
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2006-5-25
收藏
得分:0 


下面是我从网站上转载的 看下就清楚
Public Class Form1
Inherits System.Windows.Forms.Form
Private m_Icon1 As Icon
Private m_Icon2 As Icon
Private m_bFlag As Boolean
Private m_bShowWnd As Boolean
Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
Friend WithEvents Button1 As System.Windows.Forms.Button


#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()
m_bFlag = True
m_bShowWnd = True

Try

m_Icon1 = New Icon("image1.ico") '导入图标文件
m_Icon2 = New Icon("image2.ico")

Catch e As Exception

MessageBox.Show("错误 " + e.Message, "动态系统托盘 - 错误")
MenuItem2.Enabled = False
MenuItem3.Enabled = False
End Try
'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
Private components As System.ComponentModel.IContainer

'Required by the Windows Form Designer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu()
Me.MenuItem1 = New System.Windows.Forms.MenuItem()
Me.MenuItem4 = New System.Windows.Forms.MenuItem()
Me.MenuItem2 = New System.Windows.Forms.MenuItem()
Me.MenuItem5 = New System.Windows.Forms.MenuItem()
Me.MenuItem3 = New System.Windows.Forms.MenuItem()
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Label1 = New System.Windows.Forms.Label()
Me.ColorDialog1 = New System.Windows.Forms.ColorDialog()
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'ContextMenu1
'
Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem4, Me.MenuItem2, Me.MenuItem5, Me.MenuItem3})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.Text = "动画图标开始"
'
'MenuItem4
'
Me.MenuItem4.Index = 1
Me.MenuItem4.Text = "-"
'
'MenuItem2
'
Me.MenuItem2.Index = 2
Me.MenuItem2.Text = "动画图标结束"
'
'MenuItem5
'
Me.MenuItem5.Index = 3
Me.MenuItem5.Text = "-"
'
'MenuItem3
'
Me.MenuItem3.Index = 4
Me.MenuItem3.Text = "退出程序"
'
'Timer1
'
Me.Timer1.Interval = 500
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(72, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(128, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "动态系统托盘图标实例"
'
'NotifyIcon1
'
Me.NotifyIcon1.ContextMenu = Me.ContextMenu1
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)
Me.NotifyIcon1.Text = "动态系统托盘程序"
Me.NotifyIcon1.Visible = True
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(96, 64)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "隐藏窗体"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(280, 117)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.Label1})
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "Form1"
Me.ShowInTaskbar = False
Me.Text = "动态系统托盘图标"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub ContextMenu1_Popup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContextMenu1.Popup

End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Timer1.Start()

End Sub

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Timer1.Stop()

End Sub

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
Application.Exit()

End Sub

Private Sub NotifyIcon1_Disposed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Disposed

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Not (m_Icon1 Is Nothing) And Not (m_Icon2 Is Nothing) Then '如果两个图标文件都被正确载入

'只要timer1被启动,则在两个图标之间不断进行选择变换,实现动画效果
If m_bFlag = True Then
NotifyIcon1.Icon = m_Icon2
m_bFlag = False

Else

NotifyIcon1.Icon = m_Icon1
m_bFlag = True
End If
End If
End Sub

Private Sub NotifyIcon1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If (m_bShowWnd = True) Then '隐藏主界面

Me.Visible = False
m_bShowWnd = False

Else '显示主界面

Me.Visible = True
m_bShowWnd = True
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Visible = False

End Sub

Private Sub NotifyIcon1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick

Me.Visible = True
m_bShowWnd = True
End Sub
End Class

2006-05-26 02:22
Enoch
Rank: 1
等 级:新手上路
帖 子:55
专家分:0
注 册:2006-4-26
收藏
得分:0 

实现了,谢谢楼上的朋友!!


2006-05-26 17:49
梦幻情缘
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:769
专家分:20
注 册:2005-4-4
收藏
得分:0 

给予支持!

2006-05-26 23:16
Tailor
Rank: 1
等 级:新手上路
帖 子:152
专家分:0
注 册:2005-6-26
收藏
得分:0 
我也得支持一下,这也是我所要找的答案

2006-05-30 09:46
Tailor
Rank: 1
等 级:新手上路
帖 子:152
专家分:0
注 册:2005-6-26
收藏
得分:0 
支持,我也学学是怎么实现的。

2006-07-22 09:18
adair
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:250
专家分:0
注 册:2005-9-3
收藏
得分:0 



********年轻无极限******** 要時刻相信你自己,不要被自己打敗
2006-07-27 18:46
快速回复:如何把程序最小化到任务栏最右边,变成一个小图标??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012433 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved