▼Gainerメモ▼
I/Oモジュールのボタン入力


I/Oモジュールのボタンを押すことにより、テキストを非表示にするプログラムを作成する。





ソースコード

ButtonForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ButtonEx {
    public partial class ButtonForm : Form{
        private Gainer gio;

        //コンストラクタ
        public ButtonForm() {
            InitializeComponent();            
        }

        //ロード時の初期化
        private void ButtonForm_Load(object sender, EventArgs e) {
            gio=new Gainer("localhost",2000,Gainer.MODE1,true);
            gio.onReady+=onReady;
            gio.onPressed+=onPressed;
            gio.onReleased+=onReleased;
        }

        //gspとの接続成功時に発生
        private void onReady() {
            lblText.Visible=true;
        }    

        //I/Oモジュールのボタンが押された時に発生
        private void onPressed() {
            lblText.Visible=false;
        }

        //I/Oモジュールのボタンが離された時に発生
        private void onReleased() {
            lblText.Visible=true;
        }    
    }
}



−戻る−