资源简介
如何用C#做一个悬浮窗口程序?
网上有许多的教材但没有源码下载,自己写了一个于大家分享,内附教程.
用C#做一个像FlashGet的悬浮窗口,其实很简单,不像以前需要调用很多系统API。大致的步骤如下。
首先是主窗体部分,悬浮窗口部分

代码片段和文件信息
//by lonleung 2008-12-10 00:15
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication20
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private FormWindowState fwsPrevious;
private frmTopMost myTopMost;
private void frmMain_Load(object sender System.EventArgs e)
{
// Save window state
fwsPrevious = this.WindowState;
// Create top most window
myTopMost = new frmTopMost(this);
}
private void frmMain_SizeChanged(object sender EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
// Window minimized
// Show top most window
myTopMost.Show();
this.ShowInTaskbar = false;
}
else if (this.WindowState != fwsPrevious)
{
// Save current window state
fwsPrevious = this.WindowState;
}
}
///
/// Restore window state
///
public void RestoreWindow()
{
this.WindowState = fwsPrevious;
this.ShowInTaskbar = true;
}
private void TOPToolStripMenuItem_Click(object sender EventArgs e)
{
myTopMost.Show();
}
private void mostToolStripMenuItem_Click(object sender EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender EventArgs e)
{
string strName = “功能“ + Convert.ToString(this.tabControl1.TabPages.Count + 1);
string strTap = “tabPage“ + Convert.ToString(this.tabControl1.TabPages.Count);
this.tabControl1.TabPages.Add(strTap strName);
}
private void button2_Click(object sender EventArgs e)
{
int seleIndex = tabControl1.SelectedIndex;
this.tabControl1.TabPages.RemoveAt(seleIndex);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 12800 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20\bin\Debug\WindowsFormsApplication20.exe
文件 36352 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20\bin\Debug\WindowsFormsApplication20.pdb
文件 14328 2008-12-11 08:56 模仿迅雷浮动窗\WindowsFormsApplication20\bin\Debug\WindowsFormsApplication20.vshost.exe
文件 490 2007-07-21 01:33 模仿迅雷浮动窗\WindowsFormsApplication20\bin\Debug\WindowsFormsApplication20.vshost.exe.manifest
文件 2346 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20\Form1.cs
文件 5279 2008-12-11 00:39 模仿迅雷浮动窗\WindowsFormsApplication20\Form1.Designer.cs
文件 6019 2008-12-11 00:39 模仿迅雷浮动窗\WindowsFormsApplication20\Form1.resx
文件 3039 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20\frmTopMost.cs
文件 3808 2008-12-10 23:29 模仿迅雷浮动窗\WindowsFormsApplication20\frmTopMost.Designer.cs
文件 6019 2008-12-10 23:29 模仿迅雷浮动窗\WindowsFormsApplication20\frmTopMost.resx
文件 2744 2008-12-11 08:56 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.csproj.FileListAbsolute.txt
文件 910 2008-12-11 00:39 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.csproj.GenerateResource.Cache
文件 12800 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.exe
文件 180 2008-12-11 00:39 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.frmMain.resources
文件 180 2008-12-10 23:29 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.frmTopMost.resources
文件 36352 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.pdb
文件 180 2008-12-10 22:48 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\WindowsFormsApplication20.Properties.Resources.resources
文件 488 2008-12-10 22:44 模仿迅雷浮动窗\WindowsFormsApplication20\Program.cs
文件 1406 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20\Properties\AssemblyInfo.cs
文件 2900 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20\Properties\Resources.Designer.cs
文件 5612 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20\Properties\Resources.resx
文件 1110 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20\Properties\Settings.Designer.cs
文件 249 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20\Properties\Settings.settings
文件 3746 2008-12-10 22:48 模仿迅雷浮动窗\WindowsFormsApplication20\WindowsFormsApplication20.csproj
文件 965 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20.sln
..A..H. 25088 2008-12-11 08:57 模仿迅雷浮动窗\WindowsFormsApplication20.suo
目录 0 2008-12-10 22:44 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\Refactor
目录 0 2008-12-10 22:43 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug\TempPE
目录 0 2008-12-10 22:45 模仿迅雷浮动窗\WindowsFormsApplication20\bin\Debug
目录 0 2008-12-11 00:41 模仿迅雷浮动窗\WindowsFormsApplication20\obj\Debug
............此处省略9个文件信息
相关资源
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
- c# 高校档案信息管理系统
- c#向word文件插入图片
- C#左侧导航菜单(动态生成)
评论
共有 条评论