📄 frmaccountdetails.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Example_1
{
/// <summary>
/// Summary description for frmAccountDetails.
/// </summary>
public class frmAccountDetails : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblBalanceAmt;
private System.Windows.Forms.Label lblViewTransactions;
private System.Windows.Forms.TextBox txtBalanceAmt;
private System.Windows.Forms.ComboBox cboViewTransaction;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.ListBox lstDetails;
private System.Windows.Forms.Label lblViewDate;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frmAccountDetails()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblBalanceAmt = new System.Windows.Forms.Label();
this.lblViewTransactions = new System.Windows.Forms.Label();
this.txtBalanceAmt = new System.Windows.Forms.TextBox();
this.cboViewTransaction = new System.Windows.Forms.ComboBox();
this.btnExit = new System.Windows.Forms.Button();
this.lstDetails = new System.Windows.Forms.ListBox();
this.lblViewDate = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblBalanceAmt
//
this.lblBalanceAmt.Location = new System.Drawing.Point(16, 24);
this.lblBalanceAmt.Name = "lblBalanceAmt";
this.lblBalanceAmt.Size = new System.Drawing.Size(96, 23);
this.lblBalanceAmt.TabIndex = 0;
this.lblBalanceAmt.Text = " 帐户余额:";
//
// lblViewTransactions
//
this.lblViewTransactions.Location = new System.Drawing.Point(16, 56);
this.lblViewTransactions.Name = "lblViewTransactions";
this.lblViewTransactions.Size = new System.Drawing.Size(120, 23);
this.lblViewTransactions.TabIndex = 0;
this.lblViewTransactions.Text = "查看交易时间范围:";
//
// txtBalanceAmt
//
this.txtBalanceAmt.Location = new System.Drawing.Point(142, 24);
this.txtBalanceAmt.Name = "txtBalanceAmt";
this.txtBalanceAmt.ReadOnly = true;
this.txtBalanceAmt.Size = new System.Drawing.Size(114, 21);
this.txtBalanceAmt.TabIndex = 2;
this.txtBalanceAmt.Text = "";
//
// cboViewTransaction
//
this.cboViewTransaction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboViewTransaction.Location = new System.Drawing.Point(142, 56);
this.cboViewTransaction.Name = "cboViewTransaction";
this.cboViewTransaction.Size = new System.Drawing.Size(114, 21);
this.cboViewTransaction.TabIndex = 3;
this.cboViewTransaction.SelectedIndexChanged += new System.EventHandler(this.cboViewTransaction_SelectedIndexChanged);
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(184, 168);
this.btnExit.Name = "btnExit";
this.btnExit.TabIndex = 1;
this.btnExit.Text = "退出(&X)";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// lstDetails
//
this.lstDetails.Location = new System.Drawing.Point(142, 88);
this.lstDetails.Name = "lstDetails";
this.lstDetails.Size = new System.Drawing.Size(114, 69);
this.lstDetails.TabIndex = 4;
this.lstDetails.Visible = false;
this.lstDetails.SelectedIndexChanged += new System.EventHandler(this.lstDetails_SelectedIndexChanged);
//
// lblViewDate
//
this.lblViewDate.Location = new System.Drawing.Point(16, 88);
this.lblViewDate.Name = "lblViewDate";
this.lblViewDate.Size = new System.Drawing.Size(104, 16);
this.lblViewDate.TabIndex = 0;
this.lblViewDate.Text = "选择日期:";
this.lblViewDate.Visible = false;
//
// frmAccountDetails
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.ClientSize = new System.Drawing.Size(296, 205);
this.Controls.Add(this.lstDetails);
this.Controls.Add(this.cboViewTransaction);
this.Controls.Add(this.txtBalanceAmt);
this.Controls.Add(this.lblBalanceAmt);
this.Controls.Add(this.lblViewTransactions);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.lblViewDate);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Name = "frmAccountDetails";
this.Text = "帐户详情";
this.Load += new System.EventHandler(this.frmAccountDetails_Load);
this.ResumeLayout(false);
}
#endregion
private void frmAccountDetails_Load(object sender, System.EventArgs e)
{
this.txtBalanceAmt.Text = "2500";
this.cboViewTransaction.Items.Add("当前月份");
this.cboViewTransaction.Items.Add("前一个月");
this.cboViewTransaction.Items.Add("前六个月");
}
private void cboViewTransaction_SelectedIndexChanged(object sender, System.EventArgs e)
{
int day = 12;
int month = 1;
if(this.cboViewTransaction.SelectedIndex==0)
{
this.lstDetails.Visible=true;
this.lblViewDate.Visible = true;
this.lstDetails.Items.Clear();
for(int count=0;count<3;count++)
{
this.lstDetails.Items.Add(Convert.ToInt32(day).ToString()+"/08/2005");
day += 3;
}
}
else if(this.cboViewTransaction.SelectedIndex==1)
{
this.lstDetails.Items.Clear();
for(int count=0;count<3;count++)
{
this.lstDetails.Items.Add(Convert.ToInt32(day).ToString()+"/07/2005");
day += 5;
}
}
else
{
this.lstDetails.Items.Clear();
for(int count=0;count<6;count++)
{
this.lstDetails.Items.Add(Convert.ToInt32(day).ToString()+"/"+Convert.ToInt32(month).ToString()+"/2005");
day += 3;
month++;
}
}
}
private void btnExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void lstDetails_SelectedIndexChanged(object sender, System.EventArgs e)
{
string str = "信用卡金额:300";
str += "\r\n移动话费充值:20";
str += "\r\n电费帐单:25";
frmTransactions objTransactions = new frmTransactions(str);
objTransactions.Show();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -