www.pudn.com > IntMail.rar > FrmLoading.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace IntMail
{
public partial class FrmLoading : Form
{
public FrmLoading()
{
InitializeComponent();
const int CS_DropSHADOW = 0x20000;
const int GCL_STYLE = (-26);
WinAPI.SetClassLong(this.Handle, GCL_STYLE, WinAPI.GetClassLong(this.Handle, GCL_STYLE) | CS_DropSHADOW);
}
//设置启动计数
int StartCount = 0;
int timecount = 0;
private void timer1_Tick(object sender, EventArgs e)
{
timecount++;
if (timecount > 4)
{
if (StartCount == 0)
{
FrmLogin _fmlogin = new FrmLogin();
// RegMail.
_fmlogin.Show();
this.Close();
}
else
{
Form1 _fm = new Form1();
_fm.Show();
this.Close();
}
}
else
{
timecount++;
}
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Parent = WinAPI.GetWindow();
return cp;
}
}
private void SetWindowShadow(byte bAlpha)
{
WinAPI.SetWindowLong(this.Handle, (int)WinAPI.WindowStyle.GWL_EXSTYLE, WinAPI.GetWindowLong(this.Handle, (int)WinAPI.WindowStyle.GWL_EXSTYLE) | (uint)WinAPI.ExWindowStyle.WS_EX_LAYERED);
WinAPI.SetLayeredWindowAttributes(this.Handle, 0, bAlpha, WinAPI.LWA_COLORKEY | WinAPI.LWA_ALPHA);
}
private void FrmLoading_Load(object sender, EventArgs e)
{
try
{
CommonMail.init();
DataSet ds = new DataSet();
ds = CommonMail.Search("select * from MailAddress");
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
MailAddress.MailAddressD = ds.Tables[0].Rows[0]["MailAddress"].ToString();
MailAddress.MailAddressPOP3 = ds.Tables[0].Rows[0]["MailAddressPOP3"].ToString();
MailAddress.MailAddressSMTP = ds.Tables[0].Rows[0]["MailAddressSMTP"].ToString();
MailAddress.MailAddressUser = ds.Tables[0].Rows[0]["MailAddressUser"].ToString();
MailAddress.MailAddressPass = ds.Tables[0].Rows[0]["MailAddressPass"].ToString();
StartCount = 1;
}
}
}
catch (Exception ex)
{
MessageBox.Show("数据文件出现异常");
}
}
}
}