///窗体显示
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Opacity > 0.01)
{
this.Opacity = this.Opacity - 0.01;
}
else
{
this.timer1.Enabled = false;
this.Hide();
Main m = new Main();
m.Show();
}
}
----------------------------------------------------------------------------------------
public partial class Formdonghua : Form
{
//动画窗体调用,关闭时将向上移出屏幕
[System.Runtime.InteropServices.DllImport("user32")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
const int AW_HOR_POSITIVE = 0x0001;
const int AW_HOR_NEGATIVE = 0x0002;
const int AW_VER_POSITIVE = 0x0004;
const int AW_VER_NEGATIVE = 0x0008;
const int AW_CENTER = 0x0010;
const int AW_HIDE = 0x10000;
const int AW_ACTIVATE = 0x20000;
const int AW_SLIDE = 0x40000;
const int AW_BLEND = 0x80000;
//…………………………………………………………
public Formdonghua()
{
InitializeComponent();
}
private void Formdonghua_Load(object sender, EventArgs e)
{
//动画由小渐大,现在取消
AnimateWindow(this.Handle, 1000, AW_CENTER | AW_ACTIVATE);
//主界面渐变设置
this.jianbian.Enabled = true;//让jianbian的timer值有效
this.Opacity = 0;
//………………………………………………
}
private void jianbian_Tick(object sender, EventArgs e)
{
//让背景由0变到1
if (this.Opacity < 1)
{
this.Opacity = this.Opacity + 0.05;
}
else
{
this.jianbian.Enabled = false;
}
}
private void Formdonghua_FormClosing(object sender, FormClosingEventArgs e)
{//关闭时动画
AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | AW_VER_NEGATIVE);
}
}
}
---------------------------------------------------------------------------------------------
using System.Mangerment;
ConnectionOptions options = new ConnectionOptions ( ) ;
options.Username ="userName";
options.Password = "pwd" ;
ManagementScope scope = new ManagementScope( "" + "ip_add" + "[url=file://root//cimv2]//root//cimv2[/url] ", options ) ;
scope.Connect ( ) ;
System.Management.ObjectQuery oq = new System.Management.ObjectQuery ( "SELECT * FROM Win32_OperatingSystem" ) ;
ManagementObjectSearcher query1 = new ManagementObjectSearcher ( scope , oq ) ;
//WMI
ManagementObjectCollection queryCollection1 = query1.Get ( ) ;
foreach ( ManagementObject mo in queryCollection1 )
{
string [ ] ss= { "" } ;
//restart computer
mo.InvokeMethod ( "Reboot" , ss ) ;
}
------------------------------// 获取已设置无法关闭窗口创建参数-------------------------------------------
protected override CreateParams CreateParams
{
get
{
int CS_NOCLOSE = 0x200;
CreateParams parameters = base.CreateParams;
parameters.ClassStyle |= CS_NOCLOSE;
return parameters;
}
}
public NoCloseForm()
{
InitializeComponent();
}
----------------------------- 全 屏 ------------------------------------------------------------
private void Form1_Load(object sender, EventArgs e)
{
this.SetVisibleCore(false);
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
this.SetVisibleCore(true);
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Opacity > 0.01)
{
this.Opacity = this.Opacity - 0.01;
}
else
{
this.timer1.Enabled = false;
this.Hide();
Main m = new Main();
m.Show();
}
}
----------------------------------------------------------------------------------------
public partial class Formdonghua : Form
{
//动画窗体调用,关闭时将向上移出屏幕
[System.Runtime.InteropServices.DllImport("user32")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
const int AW_HOR_POSITIVE = 0x0001;
const int AW_HOR_NEGATIVE = 0x0002;
const int AW_VER_POSITIVE = 0x0004;
const int AW_VER_NEGATIVE = 0x0008;
const int AW_CENTER = 0x0010;
const int AW_HIDE = 0x10000;
const int AW_ACTIVATE = 0x20000;
const int AW_SLIDE = 0x40000;
const int AW_BLEND = 0x80000;
//…………………………………………………………
public Formdonghua()
{
InitializeComponent();
}
private void Formdonghua_Load(object sender, EventArgs e)
{
//动画由小渐大,现在取消
AnimateWindow(this.Handle, 1000, AW_CENTER | AW_ACTIVATE);
//主界面渐变设置
this.jianbian.Enabled = true;//让jianbian的timer值有效
this.Opacity = 0;
//………………………………………………
}
private void jianbian_Tick(object sender, EventArgs e)
{
//让背景由0变到1
if (this.Opacity < 1)
{
this.Opacity = this.Opacity + 0.05;
}
else
{
this.jianbian.Enabled = false;
}
}
private void Formdonghua_FormClosing(object sender, FormClosingEventArgs e)
{//关闭时动画
AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | AW_VER_NEGATIVE);
}
}
}
---------------------------------------------------------------------------------------------
using System.Mangerment;
ConnectionOptions options = new ConnectionOptions ( ) ;
options.Username ="userName";
options.Password = "pwd" ;
ManagementScope scope = new ManagementScope( "" + "ip_add" + "[url=file://root//cimv2]//root//cimv2[/url] ", options ) ;
scope.Connect ( ) ;
System.Management.ObjectQuery oq = new System.Management.ObjectQuery ( "SELECT * FROM Win32_OperatingSystem" ) ;
ManagementObjectSearcher query1 = new ManagementObjectSearcher ( scope , oq ) ;
//WMI
ManagementObjectCollection queryCollection1 = query1.Get ( ) ;
foreach ( ManagementObject mo in queryCollection1 )
{
string [ ] ss= { "" } ;
//restart computer
mo.InvokeMethod ( "Reboot" , ss ) ;
}
------------------------------// 获取已设置无法关闭窗口创建参数-------------------------------------------
protected override CreateParams CreateParams
{
get
{
int CS_NOCLOSE = 0x200;
CreateParams parameters = base.CreateParams;
parameters.ClassStyle |= CS_NOCLOSE;
return parameters;
}
}
public NoCloseForm()
{
InitializeComponent();
}
----------------------------- 全 屏 ------------------------------------------------------------
private void Form1_Load(object sender, EventArgs e)
{
this.SetVisibleCore(false);
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
this.SetVisibleCore(true);
}