//注意在工程上添加系统引用System.Drawing 否则System点不出Drawing来。

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using DevComponents.DotNetBar;

namespace TaskBarFloatWnd

{

public partial class Form1 : Office2007Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

TaskBarWnd taskWnd = new TaskBarWnd();

System.Drawing.Rectangle r = System.Windows.Forms.Screen.GetWorkingArea(taskWnd);

taskWnd.Location = new System.Drawing.Point(r.Right - taskWnd.Width, r.Bottom - taskWnd.Height);

taskWnd.Show();

}

}

}

cbef093dcc044b2793832001e2365e43.pngusingSystem;

cbef093dcc044b2793832001e2365e43.pngusingSystem.Collections.Generic;

cbef093dcc044b2793832001e2365e43.pngusingSystem.ComponentModel;

cbef093dcc044b2793832001e2365e43.pngusingSystem.Data;

cbef093dcc044b2793832001e2365e43.pngusingSystem.Drawing;

cbef093dcc044b2793832001e2365e43.pngusingSystem.Text;

cbef093dcc044b2793832001e2365e43.pngusingSystem.Windows.Forms;

cbef093dcc044b2793832001e2365e43.pngusingDevComponents.DotNetBar;

cbef093dcc044b2793832001e2365e43.png

cbef093dcc044b2793832001e2365e43.pngnamespaceTaskBarFloatWnd

2f88ce130b654eb5dc6788e02dbcfc90.png

dbf989d57862681739b642d8621fe1f0.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.pngpublicpartialclassTaskBarWnd : Office2007Form

f70a0fde2b51b7dd92a70e712e540cf6.png

edb48e6f68462ea23d9a824f01de40c5.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.pngpublicTaskBarWnd()

f70a0fde2b51b7dd92a70e712e540cf6.png

edb48e6f68462ea23d9a824f01de40c5.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.png            InitializeComponent();

df37983f39daa189b8c814e01a6a9011.png            actform=GetActiveWindow();

4a5daaec04350a363f186a4d2c5ed6ce.png        }df37983f39daa189b8c814e01a6a9011.pngprivateboolisFristShow=true;//标识是否是首次加载df37983f39daa189b8c814e01a6a9011.png[System.Runtime.InteropServices.DllImport("user32.dll")]

df37983f39daa189b8c814e01a6a9011.pngpublicstaticexternIntPtr GetActiveWindow();//获得当前活动窗体df37983f39daa189b8c814e01a6a9011.png[System.Runtime.InteropServices.DllImport("user32.dll")]

df37983f39daa189b8c814e01a6a9011.pngpublicstaticexternIntPtr SetActiveWindow(IntPtr hwnd);//设置活动窗体df37983f39daa189b8c814e01a6a9011.pngdf37983f39daa189b8c814e01a6a9011.pngprivateIntPtr actform=IntPtr.Zero;//保存自己得到焦点前拥有活动窗体的柄df37983f39daa189b8c814e01a6a9011.pngprivatevoidTaskBarWnd_Load(objectsender, EventArgs e)

f70a0fde2b51b7dd92a70e712e540cf6.png

edb48e6f68462ea23d9a824f01de40c5.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.png            textBox1.Text=DateTime.Now+"——";

df37983f39daa189b8c814e01a6a9011.png            textBox1.Text=textBox1.Text+"目前正对网元1进行做单操作,10分钟内请大家避让";

df37983f39daa189b8c814e01a6a9011.png

4a5daaec04350a363f186a4d2c5ed6ce.png        }df37983f39daa189b8c814e01a6a9011.pngprotectedoverridevoidOnActivated(EventArgs e)

f70a0fde2b51b7dd92a70e712e540cf6.png

edb48e6f68462ea23d9a824f01de40c5.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.pngbase.OnActivated(e);

df37983f39daa189b8c814e01a6a9011.pngif(isFristShow==true)

f70a0fde2b51b7dd92a70e712e540cf6.png

edb48e6f68462ea23d9a824f01de40c5.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.png                SetActiveWindow(actform);

df37983f39daa189b8c814e01a6a9011.png                isFristShow=false;

4a5daaec04350a363f186a4d2c5ed6ce.png            }4a5daaec04350a363f186a4d2c5ed6ce.png        }df37983f39daa189b8c814e01a6a9011.png

df37983f39daa189b8c814e01a6a9011.png       

df37983f39daa189b8c814e01a6a9011.png

df37983f39daa189b8c814e01a6a9011.pngprivatevoidTaskBarWnd_FormClosing(objectsender, FormClosingEventArgs e)

f70a0fde2b51b7dd92a70e712e540cf6.png

edb48e6f68462ea23d9a824f01de40c5.png918e8df969f9f8c8d002f25cda86cade.png{

df37983f39daa189b8c814e01a6a9011.png            

4a5daaec04350a363f186a4d2c5ed6ce.png        }4a5daaec04350a363f186a4d2c5ed6ce.png    }0ac3a2d53663ec01c7f7225264eeefae.png}

posted on 2010-02-26 16:14 天书 阅读(2433) 评论(1)  编辑 收藏 引用

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐