?? report.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Sale.UILevel
{
/// <summary>
/// Report 的摘要說明。
/// </summary>
public class Report : System.Windows.Forms.Form
{
private CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button btnExit;
private System.Data.SqlClient.SqlConnection sqlConnection1;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public Report()
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設計器生成的代碼
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Report));
this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
this.label1 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.btnExit = new System.Windows.Forms.Button();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.SuspendLayout();
//
// crystalReportViewer1
//
this.crystalReportViewer1.ActiveViewIndex = -1;
this.crystalReportViewer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.crystalReportViewer1.Location = new System.Drawing.Point(16, 56);
this.crystalReportViewer1.Name = "crystalReportViewer1";
this.crystalReportViewer1.ReportSource = null;
this.crystalReportViewer1.Size = new System.Drawing.Size(452, 308);
this.crystalReportViewer1.TabIndex = 0;
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 23);
this.label1.TabIndex = 1;
this.label1.Text = "選擇報表";
//
// comboBox1
//
this.comboBox1.Items.AddRange(new object[] {
"-請選擇-",
"商品報表",
"進貨報表",
"銷售報表",
"庫存報表",
""});
this.comboBox1.Location = new System.Drawing.Point(104, 16);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(88, 20);
this.comboBox1.TabIndex = 2;
this.comboBox1.Text = "-請選擇-";
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// btnExit
//
this.btnExit.Image = ((System.Drawing.Image)(resources.GetObject("btnExit.Image")));
this.btnExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExit.Location = new System.Drawing.Point(360, 24);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(64, 24);
this.btnExit.TabIndex = 3;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "packet size=4096;integrated security=SSPI;data source=localhost;persist security " +
"info=False;initial catalog=Sell";
//
// Report
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(492, 393);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.crystalReportViewer1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Report";
this.Text = "打印報表";
this.ResumeLayout(false);
}
#endregion
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
int selectedindex=this.comboBox1.SelectedIndex;
switch(selectedindex)
{
case 1:
this.crystalReportViewer1.ReportSource=Application.StartupPath+"\\商品列表.rpt";
break;
case 2:
this.crystalReportViewer1.ReportSource=Application.StartupPath+"\\商品進貨.rpt";
break;
case 3:
this.crystalReportViewer1.ReportSource=Application.StartupPath+"\\商品列表.rpt";
break;
case 4:
this.crystalReportViewer1.ReportSource=Application.StartupPath+"\\商品進貨.rpt";
break;
case 0:
return;
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -