📄 reportform.cs
字号:
this.reportView.ReportSource = null;
this.reportView.ShowCloseButton = false;
this.reportView.ShowGroupTreeButton = false;
this.reportView.ShowTextSearchButton = false;
this.reportView.Size = new System.Drawing.Size(792, 496);
this.reportView.TabIndex = 0;
//
// ReportForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(800, 600);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.panel6,
this.panel5,
this.panel4,
this.panel2,
this.panel1,
this.plRight,
this.plLeft,
this.plBotton,
this.plTop});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ReportForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "阳光公交宝典";
this.Load += new System.EventHandler(this.ReportForm_Load);
this.panel4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
this.panel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.plRight.ResumeLayout(false);
this.plTop.ResumeLayout(false);
this.plLeft.ResumeLayout(false);
this.plBotton.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.ResumeLayout(false);
}
#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)
{
MainForm.ActiveForm.Close();
}
#endregion
#region 设置数据源=============================================
/// <summary>
/// 设置数据源
/// </summary>
private void SetDataBase()
{
switch(this.reportNo)
{
case 1://汽车详细列表
//设置BusTable
this.dtBus = MainForm.ds.Tables[0];
break;
case 2://汽车详细资料和站点列表
//设置BusTable
this.dtBus = MainForm.ds.Tables[0];
//设置StopTable
this.dtStop = new DataAccess.Stop().GetStopDataset(this.busID).Tables[0];
break;
}
}
#endregion
#region 报表处理===============================================
/// <summary>
/// 报表处理
/// </summary>
private void ReportProcess()
{
try
{
switch(this.reportNo)
{
case 1://汽车详细列表
DataRow[] drArray = this.dtBus.Select();
for(int i=0;i<drArray.Length;i++)
{
this.mBusListData.Bus.ImportRow(drArray[i]);
}
((TextObject)this.mBusListReport.ReportDefinition.ReportObjects["txbTitle"]).Text = "下面是"+this.cityName+"所有公交车的列表";
((TextObject)this.mBusListReport.ReportDefinition.ReportObjects["txbStartStopName"]).Text = this.statrStopName;
((TextObject)this.mBusListReport.ReportDefinition.ReportObjects["txbEndStopName"]).Text = this.endStopName;
this.mBusListReport.SetDataSource(this.mBusListData);
this.reportView.ReportSource = this.mBusListReport;
this.reportView.Show();
break;
case 2://汽车详细资料和站点列表
// this.mBusData.Bus.DataSet.Merge(this.dtBus);
// this.mBusData.V_Stop.DataSet.Merge(this.dtStop);
// this.mBusStopReport.SetDataSource(this.mBusData);
// this.reportView.ReportSource = this.mBusStopReport;
// this.reportView.Show();
break;
}
}
catch
{
}
}
#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])
{
ActiveForm.Close();
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -