⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 purcell.txt

📁 用C++编的小程序。
💻 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 + -