?? purcell.txt
字號:
C# & Electronic Test Instruments
by Andy Purcell
Listing 1:
(a)
public class employee
{
private string lastName;
private string firstName;
private double hourlyWage;
public employee( string lastName, string firstName)
{
this.lastName = lastName;
this.firstName = firstName;
this.hourlyWage = 10.00;
}
public double wage
{
get { return this.hourlyWage; }
set { // value is implicit
if ( value > 5.00 && value < 200.00 ) {
this.hourlyWage = value;
}
}
}
}
(b)
employee john = new employee("Doe","John");
john.wage = john.wage*1.20;
Listing 2:
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
visa32.viOpenDefaultRM(out defaultRsrcMgrSess);
visa32.viOpen(defaultRsrcMgrSess,"functionGenerator",0,0,out funcGenSess);
...
}
Listing 3:
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
/// <summary>
/// Required designer variable.
/// </summary>
private int defaultRsrcMgrSess; // Default Resource Manager session
private int funcGenSess; // functionGenerator session
private byte [] programMessage = new byte[256];
...
}
Listing 4:
private void trackBar1_Scroll(object sender, System.EventArgs e)
{
int returnCount;
// Populate the programMessage byte array from a String
programMessage = Encoding.ASCII.GetBytes("FREQ "
+ trackBar1.Value.ToString()
+ " Hz\n");
visa32.viWrite(VisaHandle,
programMessage,
programMessage.Length,
out returnCount);
}
Listing 5:
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
///
...
Agilent.Agilent33220.Interop.Agilent33220 fgen;
..
}
Listing 6:
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
fgen = new Agilent.Agilent33220.Interop.Agilent33220Class();
fgen.Initialize("functionGenerator",true,true,null);
...
}
2
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -