﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Globalization;
// カウンタヘッダー
using CcntCs;


namespace Counter
{
    /// <summary>
    /// Notify の概要の説明です。
    /// </summary>
    public class frmNotify : System.Windows.Forms.Form
    {
        public System.Windows.Forms.Button btnOK;
        public System.Windows.Forms.Button btnCancel;
        public System.Windows.Forms.GroupBox Frame1;
        public System.Windows.Forms.TextBox txtCh0Reg0;
        public System.Windows.Forms.TextBox txtCh1Reg0;
        public System.Windows.Forms.TextBox txtCh2Reg0;
        public System.Windows.Forms.TextBox txtCh3Reg0;
        public System.Windows.Forms.TextBox txtCh0Reg1;
        public System.Windows.Forms.TextBox txtCh1Reg1;
        public System.Windows.Forms.TextBox txtCh2Reg1;
        public System.Windows.Forms.TextBox txtCh3Reg1;
        public System.Windows.Forms.Label Label1;
        public System.Windows.Forms.Label Label2;
        public System.Windows.Forms.Label Label3;
        public System.Windows.Forms.Label Label4;
        public System.Windows.Forms.Label Label5;
        public System.Windows.Forms.Label Label6;
        public System.Windows.Forms.Label Label7;
        public System.Windows.Forms.Label Label8;
        public System.Windows.Forms.Label Label9;
        public System.Windows.Forms.Label Label10;
        public System.Windows.Forms.Label Label11;
        public System.Windows.Forms.Label Label12;
        public System.Windows.Forms.Label Label13;
        public System.Windows.Forms.Label Label14;
        public System.Windows.Forms.GroupBox Frame2;
        public System.Windows.Forms.RadioButton rdoError1;
        public System.Windows.Forms.RadioButton rdoError0;
        public System.Windows.Forms.GroupBox Frame3;
        public System.Windows.Forms.RadioButton rdoCarry0;
        public System.Windows.Forms.RadioButton rdoCarry1;
        public System.Windows.Forms.ToolTip ToolTip1;
        private System.ComponentModel.IContainer components;

        static bool                            bNotifyError = true;
        static bool                            bNotifyCarry = true;
        static uint[,]                         CompData = new uint[frmCounter.CHANNEL_NUM, 2]
                                               {
                                                   {    0x100,    0x150        },
                                                   {    0x200,    0x250        },
                                                   {    0x300,    0x350        },
                                                   {    0x400,    0x450        },
                                               };
        Ccnt                                   cnt                    = new Ccnt();
        private System.Windows.Forms.TextBox[] txt_Reg0 = new System.Windows.Forms.TextBox[frmCounter.CHANNEL_NUM];    // 比較レジスタ0コントロール
        private System.Windows.Forms.TextBox[] txt_Reg1 = new System.Windows.Forms.TextBox[frmCounter.CHANNEL_NUM];    // 比較レジスタ1コントロール


        public frmNotify()
        {
            //
            // Windows フォーム デザイナ サポートに必要です。
            //
            InitializeComponent();

            //-----------------------------------
            // コントロール配列設定
            //-----------------------------------
            //-----------------------------------
            // 比較レジスタ0コントロール
            //-----------------------------------
            txt_Reg0[0] = txtCh0Reg0;
            txt_Reg0[1] = txtCh1Reg0;
            txt_Reg0[2] = txtCh2Reg0;
            txt_Reg0[3] = txtCh3Reg0;
            //-----------------------------------
            // 比較レジスタ1コントロール
            //-----------------------------------
            txt_Reg1[0] = txtCh0Reg1;
            txt_Reg1[1] = txtCh1Reg1;
            txt_Reg1[2] = txtCh2Reg1;
            txt_Reg1[3] = txtCh3Reg1;
        }

        /// <summary>
        /// 使用されているリソースに後処理を実行します。
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
        /// コード エディタで変更しないでください。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.btnOK = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.Frame1 = new System.Windows.Forms.GroupBox();
            this.txtCh0Reg0 = new System.Windows.Forms.TextBox();
            this.txtCh1Reg0 = new System.Windows.Forms.TextBox();
            this.txtCh2Reg0 = new System.Windows.Forms.TextBox();
            this.txtCh3Reg0 = new System.Windows.Forms.TextBox();
            this.txtCh0Reg1 = new System.Windows.Forms.TextBox();
            this.txtCh1Reg1 = new System.Windows.Forms.TextBox();
            this.txtCh2Reg1 = new System.Windows.Forms.TextBox();
            this.txtCh3Reg1 = new System.Windows.Forms.TextBox();
            this.Label1 = new System.Windows.Forms.Label();
            this.Label2 = new System.Windows.Forms.Label();
            this.Label3 = new System.Windows.Forms.Label();
            this.Label4 = new System.Windows.Forms.Label();
            this.Label5 = new System.Windows.Forms.Label();
            this.Label6 = new System.Windows.Forms.Label();
            this.Label7 = new System.Windows.Forms.Label();
            this.Label8 = new System.Windows.Forms.Label();
            this.Label9 = new System.Windows.Forms.Label();
            this.Label10 = new System.Windows.Forms.Label();
            this.Label11 = new System.Windows.Forms.Label();
            this.Label12 = new System.Windows.Forms.Label();
            this.Label13 = new System.Windows.Forms.Label();
            this.Label14 = new System.Windows.Forms.Label();
            this.Frame2 = new System.Windows.Forms.GroupBox();
            this.rdoError1 = new System.Windows.Forms.RadioButton();
            this.rdoError0 = new System.Windows.Forms.RadioButton();
            this.Frame3 = new System.Windows.Forms.GroupBox();
            this.rdoCarry0 = new System.Windows.Forms.RadioButton();
            this.rdoCarry1 = new System.Windows.Forms.RadioButton();
            this.ToolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.Frame1.SuspendLayout();
            this.Frame2.SuspendLayout();
            this.Frame3.SuspendLayout();
            this.SuspendLayout();
            // 
            // btnOK
            // 
            this.btnOK.BackColor = System.Drawing.SystemColors.Control;
            this.btnOK.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnOK.ForeColor = System.Drawing.SystemColors.ControlText;
            this.btnOK.Location = new System.Drawing.Point(296, 179);
            this.btnOK.Name = "btnOK";
            this.btnOK.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.btnOK.Size = new System.Drawing.Size(97, 24);
            this.btnOK.TabIndex = 0;
            this.btnOK.Text = "OK";
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
            // 
            // btnCancel
            // 
            this.btnCancel.BackColor = System.Drawing.SystemColors.Control;
            this.btnCancel.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnCancel.ForeColor = System.Drawing.SystemColors.ControlText;
            this.btnCancel.Location = new System.Drawing.Point(416, 179);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.btnCancel.Size = new System.Drawing.Size(97, 24);
            this.btnCancel.TabIndex = 35;
            this.btnCancel.Text = "ｷｬﾝｾﾙ";
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            // 
            // Frame1
            // 
            this.Frame1.BackColor = System.Drawing.SystemColors.Control;
            this.Frame1.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                 this.txtCh0Reg0,
                                                                                 this.txtCh1Reg0,
                                                                                 this.txtCh2Reg0,
                                                                                 this.txtCh3Reg0,
                                                                                 this.txtCh0Reg1,
                                                                                 this.txtCh1Reg1,
                                                                                 this.txtCh2Reg1,
                                                                                 this.txtCh3Reg1,
                                                                                 this.Label1,
                                                                                 this.Label2,
                                                                                 this.Label3,
                                                                                 this.Label4,
                                                                                 this.Label5,
                                                                                 this.Label6,
                                                                                 this.Label7,
                                                                                 this.Label8,
                                                                                 this.Label9,
                                                                                 this.Label10,
                                                                                 this.Label11,
                                                                                 this.Label12,
                                                                                 this.Label13,
                                                                                 this.Label14});
            this.Frame1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Frame1.Location = new System.Drawing.Point(8, 11);
            this.Frame1.Name = "Frame1";
            this.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Frame1.Size = new System.Drawing.Size(281, 193);
            this.Frame1.TabIndex = 36;
            this.Frame1.TabStop = false;
            this.Frame1.Text = "カウント一致";
            // 
            // txtCh0Reg0
            // 
            this.txtCh0Reg0.AcceptsReturn = true;
            this.txtCh0Reg0.AutoSize = false;
            this.txtCh0Reg0.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh0Reg0.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh0Reg0.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh0Reg0.Location = new System.Drawing.Point(48, 56);
            this.txtCh0Reg0.MaxLength = 0;
            this.txtCh0Reg0.Name = "txtCh0Reg0";
            this.txtCh0Reg0.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh0Reg0.Size = new System.Drawing.Size(73, 18);
            this.txtCh0Reg0.TabIndex = 10;
            this.txtCh0Reg0.Text = "Text1";
            // 
            // txtCh1Reg0
            // 
            this.txtCh1Reg0.AcceptsReturn = true;
            this.txtCh1Reg0.AutoSize = false;
            this.txtCh1Reg0.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh1Reg0.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh1Reg0.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh1Reg0.Location = new System.Drawing.Point(48, 80);
            this.txtCh1Reg0.MaxLength = 0;
            this.txtCh1Reg0.Name = "txtCh1Reg0";
            this.txtCh1Reg0.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh1Reg0.Size = new System.Drawing.Size(73, 18);
            this.txtCh1Reg0.TabIndex = 9;
            this.txtCh1Reg0.Text = "Text1";
            // 
            // txtCh2Reg0
            // 
            this.txtCh2Reg0.AcceptsReturn = true;
            this.txtCh2Reg0.AutoSize = false;
            this.txtCh2Reg0.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh2Reg0.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh2Reg0.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh2Reg0.Location = new System.Drawing.Point(48, 104);
            this.txtCh2Reg0.MaxLength = 0;
            this.txtCh2Reg0.Name = "txtCh2Reg0";
            this.txtCh2Reg0.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh2Reg0.Size = new System.Drawing.Size(73, 18);
            this.txtCh2Reg0.TabIndex = 8;
            this.txtCh2Reg0.Text = "Text1";
            // 
            // txtCh3Reg0
            // 
            this.txtCh3Reg0.AcceptsReturn = true;
            this.txtCh3Reg0.AutoSize = false;
            this.txtCh3Reg0.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh3Reg0.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh3Reg0.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh3Reg0.Location = new System.Drawing.Point(48, 128);
            this.txtCh3Reg0.MaxLength = 0;
            this.txtCh3Reg0.Name = "txtCh3Reg0";
            this.txtCh3Reg0.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh3Reg0.Size = new System.Drawing.Size(73, 18);
            this.txtCh3Reg0.TabIndex = 7;
            this.txtCh3Reg0.Text = "Text1";
            // 
            // txtCh0Reg1
            // 
            this.txtCh0Reg1.AcceptsReturn = true;
            this.txtCh0Reg1.AutoSize = false;
            this.txtCh0Reg1.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh0Reg1.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh0Reg1.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh0Reg1.Location = new System.Drawing.Point(168, 56);
            this.txtCh0Reg1.MaxLength = 0;
            this.txtCh0Reg1.Name = "txtCh0Reg1";
            this.txtCh0Reg1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh0Reg1.Size = new System.Drawing.Size(73, 18);
            this.txtCh0Reg1.TabIndex = 6;
            this.txtCh0Reg1.Text = "Text1";
            // 
            // txtCh1Reg1
            // 
            this.txtCh1Reg1.AcceptsReturn = true;
            this.txtCh1Reg1.AutoSize = false;
            this.txtCh1Reg1.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh1Reg1.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh1Reg1.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh1Reg1.Location = new System.Drawing.Point(168, 80);
            this.txtCh1Reg1.MaxLength = 0;
            this.txtCh1Reg1.Name = "txtCh1Reg1";
            this.txtCh1Reg1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh1Reg1.Size = new System.Drawing.Size(73, 18);
            this.txtCh1Reg1.TabIndex = 5;
            this.txtCh1Reg1.Text = "Text1";
            // 
            // txtCh2Reg1
            // 
            this.txtCh2Reg1.AcceptsReturn = true;
            this.txtCh2Reg1.AutoSize = false;
            this.txtCh2Reg1.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh2Reg1.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh2Reg1.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh2Reg1.Location = new System.Drawing.Point(168, 104);
            this.txtCh2Reg1.MaxLength = 0;
            this.txtCh2Reg1.Name = "txtCh2Reg1";
            this.txtCh2Reg1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh2Reg1.Size = new System.Drawing.Size(73, 18);
            this.txtCh2Reg1.TabIndex = 4;
            this.txtCh2Reg1.Text = "Text1";
            // 
            // txtCh3Reg1
            // 
            this.txtCh3Reg1.AcceptsReturn = true;
            this.txtCh3Reg1.AutoSize = false;
            this.txtCh3Reg1.BackColor = System.Drawing.SystemColors.Window;
            this.txtCh3Reg1.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.txtCh3Reg1.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtCh3Reg1.Location = new System.Drawing.Point(168, 128);
            this.txtCh3Reg1.MaxLength = 0;
            this.txtCh3Reg1.Name = "txtCh3Reg1";
            this.txtCh3Reg1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.txtCh3Reg1.Size = new System.Drawing.Size(73, 18);
            this.txtCh3Reg1.TabIndex = 3;
            this.txtCh3Reg1.Text = "Text1";
            // 
            // Label1
            // 
            this.Label1.AutoSize = true;
            this.Label1.BackColor = System.Drawing.SystemColors.Control;
            this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label1.Location = new System.Drawing.Point(8, 59);
            this.Label1.Name = "Label1";
            this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label1.Size = new System.Drawing.Size(31, 12);
            this.Label1.TabIndex = 24;
            this.Label1.Text = "Ch0 :";
            // 
            // Label2
            // 
            this.Label2.AutoSize = true;
            this.Label2.BackColor = System.Drawing.SystemColors.Control;
            this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label2.Location = new System.Drawing.Point(8, 83);
            this.Label2.Name = "Label2";
            this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label2.Size = new System.Drawing.Size(31, 12);
            this.Label2.TabIndex = 23;
            this.Label2.Text = "Ch1 :";
            // 
            // Label3
            // 
            this.Label3.AutoSize = true;
            this.Label3.BackColor = System.Drawing.SystemColors.Control;
            this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label3.Location = new System.Drawing.Point(8, 107);
            this.Label3.Name = "Label3";
            this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label3.Size = new System.Drawing.Size(31, 12);
            this.Label3.TabIndex = 22;
            this.Label3.Text = "Ch2 :";
            // 
            // Label4
            // 
            this.Label4.AutoSize = true;
            this.Label4.BackColor = System.Drawing.SystemColors.Control;
            this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label4.Location = new System.Drawing.Point(8, 131);
            this.Label4.Name = "Label4";
            this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label4.Size = new System.Drawing.Size(31, 12);
            this.Label4.TabIndex = 21;
            this.Label4.Text = "Ch3 :";
            // 
            // Label5
            // 
            this.Label5.AutoSize = true;
            this.Label5.BackColor = System.Drawing.SystemColors.Control;
            this.Label5.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label5.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label5.Location = new System.Drawing.Point(71, 32);
            this.Label5.Name = "Label5";
            this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label5.Size = new System.Drawing.Size(30, 12);
            this.Label5.TabIndex = 20;
            this.Label5.Text = "Reg0";
            // 
            // Label6
            // 
            this.Label6.AutoSize = true;
            this.Label6.BackColor = System.Drawing.SystemColors.Control;
            this.Label6.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label6.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label6.Location = new System.Drawing.Point(192, 32);
            this.Label6.Name = "Label6";
            this.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label6.Size = new System.Drawing.Size(30, 12);
            this.Label6.TabIndex = 19;
            this.Label6.Text = "Reg1";
            // 
            // Label7
            // 
            this.Label7.AutoSize = true;
            this.Label7.BackColor = System.Drawing.SystemColors.Control;
            this.Label7.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label7.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label7.Location = new System.Drawing.Point(128, 59);
            this.Label7.Name = "Label7";
            this.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label7.Size = new System.Drawing.Size(24, 12);
            this.Label7.TabIndex = 18;
            this.Label7.Text = "Hex";
            // 
            // Label8
            // 
            this.Label8.AutoSize = true;
            this.Label8.BackColor = System.Drawing.SystemColors.Control;
            this.Label8.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label8.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label8.Location = new System.Drawing.Point(128, 83);
            this.Label8.Name = "Label8";
            this.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label8.Size = new System.Drawing.Size(24, 12);
            this.Label8.TabIndex = 17;
            this.Label8.Text = "Hex";
            // 
            // Label9
            // 
            this.Label9.AutoSize = true;
            this.Label9.BackColor = System.Drawing.SystemColors.Control;
            this.Label9.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label9.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label9.Location = new System.Drawing.Point(128, 107);
            this.Label9.Name = "Label9";
            this.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label9.Size = new System.Drawing.Size(24, 12);
            this.Label9.TabIndex = 16;
            this.Label9.Text = "Hex";
            // 
            // Label10
            // 
            this.Label10.AutoSize = true;
            this.Label10.BackColor = System.Drawing.SystemColors.Control;
            this.Label10.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label10.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label10.Location = new System.Drawing.Point(128, 131);
            this.Label10.Name = "Label10";
            this.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label10.Size = new System.Drawing.Size(24, 12);
            this.Label10.TabIndex = 15;
            this.Label10.Text = "Hex";
            // 
            // Label11
            // 
            this.Label11.AutoSize = true;
            this.Label11.BackColor = System.Drawing.SystemColors.Control;
            this.Label11.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label11.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label11.Location = new System.Drawing.Point(248, 59);
            this.Label11.Name = "Label11";
            this.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label11.Size = new System.Drawing.Size(24, 12);
            this.Label11.TabIndex = 14;
            this.Label11.Text = "Hex";
            // 
            // Label12
            // 
            this.Label12.AutoSize = true;
            this.Label12.BackColor = System.Drawing.SystemColors.Control;
            this.Label12.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label12.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label12.Location = new System.Drawing.Point(248, 83);
            this.Label12.Name = "Label12";
            this.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label12.Size = new System.Drawing.Size(24, 12);
            this.Label12.TabIndex = 13;
            this.Label12.Text = "Hex";
            // 
            // Label13
            // 
            this.Label13.AutoSize = true;
            this.Label13.BackColor = System.Drawing.SystemColors.Control;
            this.Label13.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label13.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label13.Location = new System.Drawing.Point(248, 107);
            this.Label13.Name = "Label13";
            this.Label13.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label13.Size = new System.Drawing.Size(24, 12);
            this.Label13.TabIndex = 12;
            this.Label13.Text = "Hex";
            // 
            // Label14
            // 
            this.Label14.AutoSize = true;
            this.Label14.BackColor = System.Drawing.SystemColors.Control;
            this.Label14.Cursor = System.Windows.Forms.Cursors.Default;
            this.Label14.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Label14.Location = new System.Drawing.Point(248, 131);
            this.Label14.Name = "Label14";
            this.Label14.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Label14.Size = new System.Drawing.Size(24, 12);
            this.Label14.TabIndex = 11;
            this.Label14.Text = "Hex";
            // 
            // Frame2
            // 
            this.Frame2.BackColor = System.Drawing.SystemColors.Control;
            this.Frame2.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                 this.rdoError1,
                                                                                 this.rdoError0});
            this.Frame2.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Frame2.Location = new System.Drawing.Point(296, 11);
            this.Frame2.Name = "Frame2";
            this.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Frame2.Size = new System.Drawing.Size(217, 73);
            this.Frame2.TabIndex = 37;
            this.Frame2.TabStop = false;
            this.Frame2.Text = "エラー";
            // 
            // rdoError1
            // 
            this.rdoError1.BackColor = System.Drawing.SystemColors.Control;
            this.rdoError1.Cursor = System.Windows.Forms.Cursors.Default;
            this.rdoError1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.rdoError1.Location = new System.Drawing.Point(104, 32);
            this.rdoError1.Name = "rdoError1";
            this.rdoError1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.rdoError1.Size = new System.Drawing.Size(81, 17);
            this.rdoError1.TabIndex = 27;
            this.rdoError1.Text = "非通知";
            // 
            // rdoError0
            // 
            this.rdoError0.BackColor = System.Drawing.SystemColors.Control;
            this.rdoError0.Checked = true;
            this.rdoError0.Cursor = System.Windows.Forms.Cursors.Default;
            this.rdoError0.ForeColor = System.Drawing.SystemColors.ControlText;
            this.rdoError0.Location = new System.Drawing.Point(8, 32);
            this.rdoError0.Name = "rdoError0";
            this.rdoError0.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.rdoError0.Size = new System.Drawing.Size(65, 17);
            this.rdoError0.TabIndex = 26;
            this.rdoError0.TabStop = true;
            this.rdoError0.Text = "通知";
            // 
            // Frame3
            // 
            this.Frame3.BackColor = System.Drawing.SystemColors.Control;
            this.Frame3.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                 this.rdoCarry0,
                                                                                 this.rdoCarry1});
            this.Frame3.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Frame3.Location = new System.Drawing.Point(296, 91);
            this.Frame3.Name = "Frame3";
            this.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Frame3.Size = new System.Drawing.Size(217, 73);
            this.Frame3.TabIndex = 38;
            this.Frame3.TabStop = false;
            this.Frame3.Text = "キャリー / ボロー";
            // 
            // rdoCarry0
            // 
            this.rdoCarry0.BackColor = System.Drawing.SystemColors.Control;
            this.rdoCarry0.Checked = true;
            this.rdoCarry0.Cursor = System.Windows.Forms.Cursors.Default;
            this.rdoCarry0.ForeColor = System.Drawing.SystemColors.ControlText;
            this.rdoCarry0.Location = new System.Drawing.Point(8, 32);
            this.rdoCarry0.Name = "rdoCarry0";
            this.rdoCarry0.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.rdoCarry0.Size = new System.Drawing.Size(65, 17);
            this.rdoCarry0.TabIndex = 30;
            this.rdoCarry0.TabStop = true;
            this.rdoCarry0.Text = "通知";
            // 
            // rdoCarry1
            // 
            this.rdoCarry1.BackColor = System.Drawing.SystemColors.Control;
            this.rdoCarry1.Cursor = System.Windows.Forms.Cursors.Default;
            this.rdoCarry1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.rdoCarry1.Location = new System.Drawing.Point(104, 32);
            this.rdoCarry1.Name = "rdoCarry1";
            this.rdoCarry1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.rdoCarry1.Size = new System.Drawing.Size(81, 17);
            this.rdoCarry1.TabIndex = 29;
            this.rdoCarry1.Text = "非通知";
            // 
            // frmNotify
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
            this.ClientSize = new System.Drawing.Size(520, 214);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.btnCancel,
                                                                          this.Frame1,
                                                                          this.Frame2,
                                                                          this.Frame3,
                                                                          this.btnOK});
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "frmNotify";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "通知設定";
            this.Load += new System.EventHandler(this.frmNotify_Load);
            this.Frame1.ResumeLayout(false);
            this.Frame2.ResumeLayout(false);
            this.Frame3.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        #endregion

        //===================================================
        //    ダイアログ初期化
        //===================================================
        private void frmNotify_Load(object sender, System.EventArgs e)
        {
            //-------------------------------
            // 初期データのセット
            //-------------------------------
            string szBuf = new string(' ', 100);
            short  ch;

            //-------------------------------
            // 各チャネルごとに
            //-------------------------------
            for (ch = 0; ch < frmCounter.CHANNEL_NUM; ch++)
            {
                //----------------
                // 比較値データのセット
                //----------------
                szBuf = string.Format("{0:X}", CompData[ch, 0]);
                txt_Reg0[ch].Text = szBuf;
                szBuf = string.Format("{0:X}", CompData[ch, 1]);
                txt_Reg1[ch].Text = szBuf;
                //----------------
                // 総チャネル数を超えた場合比較レジスタ表示を無効化
                //----------------
                if(ch >= frmCounter.ChannelNum){
                    txt_Reg0[ch].Enabled = false;
                    txt_Reg1[ch].Enabled = false;
                //----------------
                // 総チャネル数以下の場合表示を有効化
                //----------------
                }else{
                    txt_Reg0[ch].Enabled = true;
                    txt_Reg1[ch].Enabled = true;
                }
            }

            if (bNotifyError == true) 
            {
                rdoError0.Checked = true;
            }
            else 
            {
                rdoError1.Checked = true;
            }
            if (bNotifyCarry == true) 
            {
                rdoCarry0.Checked = true;
            }
            else 
            {
                rdoCarry1.Checked = true;
            }
        }

        //---------------------------------------------
        // 設定完了処理
        //---------------------------------------------
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            string szBuf = new string(' ', 100);
            int    ret;
            short  ChNo, RegNo;
            string str;
            string error_string = new string(' ', 256);

            //-------------------------------
            // 設定情報の取得
            //-------------------------------
            for (ChNo = 0; ChNo < frmCounter.ChannelNum; ChNo++)
            {
                szBuf = txt_Reg0[ChNo].Text;
                CompData[ChNo, 0] = uint.Parse(szBuf, NumberStyles.HexNumber);
                szBuf = txt_Reg1[ChNo].Text;
                CompData[ChNo, 1] = uint.Parse(szBuf, NumberStyles.HexNumber);
            }
            bNotifyError = rdoError0.Checked;
            bNotifyCarry = rdoCarry0.Checked;

            //-------------------------------
            // 設定情報をデバイスへセット
            //-------------------------------
            for (ChNo=0; ChNo<frmCounter.ChannelNum; ChNo++) 
            {
                for (RegNo=0; RegNo<2; RegNo++) 
                {
                    //-------------------------------
                    // カウント一致の通知 & 比較レジスタ 設定
                    //-------------------------------
                    ret = cnt.NotifyCountUp(frmCounter.Id, ChNo, RegNo, CompData[ChNo, RegNo], frmCounter.hMainWnd);
                    if (ret != 0) 
                    {
                        cnt.GetErrorString(ret, out error_string);
                        str = string.Format("CntNotifyCountUp : ret = {0:X} h\n {1}", ret, error_string);
                        MessageBox.Show(str, "Error", MessageBoxButtons.OK);
                        return;
                    }
                }
            }
            //-------------------------------
            // カウンタエラーが通知の場合
            //-------------------------------
            if (bNotifyError == true)
            {
                //-------------------------------
                // カウンタエラー通知 設定
                //-------------------------------
                ret = cnt.NotifyCounterError(frmCounter.Id, frmCounter.hMainWnd);
                if (ret != 0) 
                {
                    cnt.GetErrorString(ret, out error_string);
                    str = string.Format("CntNotifyCounterError : ret = {0:X} h\n {1}", ret, error_string);
                    MessageBox.Show(str, "Error", MessageBoxButtons.OK);
                    return;
                }
            }
            //-------------------------------
            // キャリー/ボローが通知の場合
            //-------------------------------
            if (bNotifyCarry == true)
            {
                //-------------------------------
                // キャリー/ボロー通知 設定
                //-------------------------------
                ret = cnt.NotifyCarryBorrow(frmCounter.Id, frmCounter.hMainWnd);
                if (ret != 0) 
                {
                    cnt.GetErrorString(ret, out error_string);
                    str = string.Format("CntNotifyCarryBorrow : ret = {0:X} h\n {1}", ret, error_string);
                    MessageBox.Show(str, "Error", MessageBoxButtons.OK);
                }
            }
            this.Close();
        }

        //---------------------------------------------
        // キャンセル処理
        //---------------------------------------------
        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }
    }
}
