📄 resultform.cs
字号:
private void btnLast_MouseLeave(object sender, System.EventArgs e)
{
this.btnBrowseLastMouseDown = false;
this.btnBrowseLastMouseOver = false;
this.DrawBrowseButton(4);
}
private void btnLast_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.btnBrowseLastMouseDown = true;
this.DrawBrowseButton(4);
}
#endregion
#region 统计信息===============================================
private void StatisticInfo()
{
string result = "";
result = "【总共"+this.totalRecordCount.ToString()+"条记录,当前记录第"+(this.recordIndex+1).ToString()+"条】";
this.lbTitle.Text = result;
}
#endregion
#region 翻动数据集处理=========================================
private void btnFirst_Click(object sender, System.EventArgs e)
{
this.recordIndex = 0;
//获取汽车详细资料
this.GetBusInfo(this.recordIndex);
//统计信息
this.StatisticInfo();
}
private void btnPrv_Click(object sender, System.EventArgs e)
{
if(recordIndex > 0 )
{
this.recordIndex--;
//获取汽车详细资料
this.GetBusInfo(this.recordIndex);
//统计信息
this.StatisticInfo();
}
}
private void btnNext_Click(object sender, System.EventArgs e)
{
if(recordIndex < (totalRecordCount - 1))
{
this.recordIndex++;
//获取汽车详细资料
this.GetBusInfo(this.recordIndex);
//统计信息
this.StatisticInfo();
}
}
private void btnLast_Click(object sender, System.EventArgs e)
{
this.recordIndex = this.totalRecordCount-1;
//获取汽车详细资料
this.GetBusInfo(this.recordIndex);
//统计信息
this.StatisticInfo();
}
#endregion
#region 移动窗口===============================================
private void pictureBox4_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
Point mousePoint = Control.MousePosition;
mousePoint.Offset(this.m_pOffset.X,this.m_pOffset.Y);
this.Location = mousePoint;
this.xPos = mousePoint.X;
this.yPos = mousePoint.Y;
if(xPos < 0)
{
xPos = 0;
}
if(yPos < 0)
{
yPos = 0;
}
this.locationMain.X = xPos;
this.locationMain.Y = yPos;
}
}
private void pictureBox4_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.m_pOffset = new Point(-e.X,-e.Y);
}
#endregion
#region 绘制窗体标题===========================================
private void pictureBox4_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
try
{
Point p = new Point(this.pictureBox4.Location.X-40,this.pictureBox4.Location.Y+5);
Graphics g = e.Graphics;
g.DrawString(SystemMessage.SYSTEM_TITLE+"系统查询结果",new Font("宋体",10),Brushes.Yellow,p);
Point p2 = new Point(p.X+1,p.Y+1);
g.DrawString(SystemMessage.SYSTEM_TITLE+"系统查询结果",new Font("宋体",10),Brushes.DarkBlue,p2);
//g.Dispose();
}
catch(System.Exception ex)
{
throw new Exception(ex.Message);
}
}
#endregion
#region 当前时间日期===========================================
private void tmClock_Tick(object sender, System.EventArgs e)
{
this.statusBarPanel1.Text = DateTime.Now.ToLongDateString()+" "+DateTime.Now.ToLongTimeString();
}
#endregion
#region 状态栏处理=============================================
private void StatusBar()
{
this.statusBarPanel2.Text = "作者:陈志峰 sunboy@sun188.com";
this.statusBarPanel3.Text = "阳光商务在线 http://www.sun188.com";
}
#endregion
#region 设置最小化关闭按钮=====================================
/// <summary>
/// 设置最小化关闭按钮
/// </summary>
/// <param name="buttonType">1.btnMin 2.btnClose</param>
private void DrawButton(int buttonType)
{
switch(buttonType)
{
case 1:
if(btnMinMouseOver)
{
if(btnMinMouseDown)
{
this.btnMinBmp = new Bitmap("images/btnMinDown.jpg");
}
else
{
this.btnMinBmp = new Bitmap("images/btnMinOver.jpg");
}
}
else
{
this.btnMinBmp = new Bitmap("images/btnMin.jpg");
}
break;
case 2:
if(btnCloseMouseOver)
{
if(btnCloseMouseDown)
{
this.btnCloseBmp = new Bitmap("images/btnCloseDown.jpg");
}
else
{
this.btnCloseBmp = new Bitmap("images/btnCloseOver.jpg");
}
}
else
{
this.btnCloseBmp = new Bitmap("images/btnClose.jpg");
}
break;
}
//邦定按钮图片
this.btnMin.Image = this.btnMinBmp;
this.btnClose.Image = this.btnCloseBmp;
}
#endregion
#region 最小化,关闭按钮事件处理================================
private void btnMin_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.btnMinMouseOver = true;
this.DrawButton(1);
}
private void btnMin_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.btnMinMouseDown = true;
this.DrawButton(1);
}
private void btnMin_MouseLeave(object sender, System.EventArgs e)
{
this.btnMinMouseOver = false;
this.btnMinMouseDown = false;
this.DrawButton(1);
}
private void btnMin_Click(object sender, System.EventArgs e)
{
MainForm.ActiveForm.WindowState=FormWindowState.Minimized;
}
private void btnClose_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.btnCloseMouseOver = true;
this.DrawButton(2);
}
private void btnClose_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.btnCloseMouseDown = true;
this.DrawButton(2);
}
private void btnClose_MouseLeave(object sender, System.EventArgs e)
{
this.btnCloseMouseOver = false;
this.btnCloseMouseDown = false;
this.DrawButton(2);
}
private void btnClose_Click(object sender, System.EventArgs e)
{
this.timerHide.Enabled = true;
}
#endregion
#region 绘制浏览按钮===========================================
/// <summary>
/// 绘制浏览按钮
/// </summary>
/// <param name="buttonType">1:btnFirst 2:bthPrv 3:btnNext 4:btnLast</param>
private void DrawBrowseButton(int buttonType)
{
switch(buttonType)
{
case 1:
if(btnBrowseFirstMouseOver)
{
if(btnBrowseFirstMouseDown)
{
this.btnFirstBmp =new Bitmap("images/btnFirstRecordDown.gif");
}
else
{
this.btnFirstBmp =new Bitmap("images/btnFirstRecordOver.gif");
}
}
else
{
this.btnFirstBmp =new Bitmap("images/btnFirstRecord.gif");
}
break;
case 2:
if(btnBrowsePrvMouseOver)
{
if(btnBrowsePrvMouseDown)
{
this.btnPrvBmp =new Bitmap("images/btnPrvRecordDown.gif");
}
else
{
this.btnPrvBmp =new Bitmap("images/btnPrvRecordOver.gif");
}
}
else
{
this.btnPrvBmp =new Bitmap("images/btnPrvRecord.gif");
}
break;
case 3:
if(btnBrowseNextMouseOver)
{
if(btnBrowseNextMouseDown)
{
this.btnNextBmp =new Bitmap("images/btnNextRecordDown.gif");
}
else
{
this.btnNextBmp =new Bitmap("images/btnNextRecordOver.gif");
}
}
else
{
this.btnNextBmp =new Bitmap("images/btnNextRecord.gif");
}
break;
case 4:
if(btnBrowseLastMouseOver)
{
if(btnBrowseLastMouseDown)
{
this.btnLastBmp =new Bitmap("images/btnLastRecordDown.gif");
}
else
{
this.btnLastBmp =new Bitmap("images/btnLastRecordOver.gif");
}
}
else
{
this.btnLastBmp =new Bitmap("images/btnLastRecord.gif");
}
break;
}
//绘制按钮
this.btnFirst.Image = this.btnFirstBmp;
this.btnPrv.Image = this.btnPrvBmp;
this.btnNext.Image = this.btnNextBmp;
this.btnLast.Image = this.btnLastBmp;
}
#endregion
#region ToolBar事件处理========================================
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
Point pLocation = new Point(this.Location.X+30,this.Location.Y+30);
Size size = new Size(600,450);
if(e.Button==this.toolBar1.Buttons[0])
{
HelpForm helpForm = new HelpForm();
helpForm.type = 1;
helpForm.Size = size;
helpForm.Location = pLocation;
helpForm.TopMost = true;
helpForm.ShowDialog();
}
else if(e.Button == this.toolBar1.Buttons[1])
{
HelpForm helpForm = new HelpForm();
helpForm.type = 2;
helpForm.Size = size;
helpForm.Location = pLocation;
helpForm.TopMost = true;
helpForm.ShowDialog();
}
else if(e.Button == this.toolBar1.Buttons[2])
{
this.timerHide.Enabled = true;
}
}
#endregion
#region 窗口淡入淡出特效处理===================================
private void timerHide_Tick(object sender, System.EventArgs e)
{
this.hideForm -= 0.2;
this.Opacity = this.hideForm;
if(this.hideForm <= 0)
{
this.timerHide.Enabled = false;
this.Close();
}
}
private void timeShow_Tick(object sender, System.EventArgs e)
{
this.showForm += 0.2;
this.Opacity = this.showForm;
if(this.showForm >= 1)
{
this.timeShow.Enabled = false;
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -