コード例 #1
0
ファイル: UIntTable.cs プロジェクト: suvjunmd/Moritz
        public UIntTable(int xDim, int yDim,
                         ModulationInputKrystal xInputKrystal, ModulationInputKrystal yInputKrystal)
        {
            InitializeComponent();

            _missingXValues = xInputKrystal.MissingAbsoluteValues;
            _missingYValues = yInputKrystal.MissingAbsoluteValues;

            if ((xDim < xInputKrystal.MaxValue) || (yDim < yInputKrystal.MaxValue))
            {
                string msg = "Table size exceeded."
                             + "\nThe maximum number of rows is " + yDim.ToString()
                             + "\nThe maximum number of columns is " + xDim.ToString();
                throw new ApplicationException(msg);
            }

            if (xDim > xInputKrystal.MaxValue)
            {
                for (int i = (int)xInputKrystal.MaxValue + 1; i <= xDim; i++)
                {
                    _missingXValues.Add(i);
                }
            }
            if (yDim > yInputKrystal.MaxValue)
            {
                for (int i = (int)yInputKrystal.MaxValue + 1; i <= yDim; i++)
                {
                    _missingYValues.Add(i);
                }
            }

            this.SuspendLayout();
            XDim = xDim;
            YDim = yDim;
            for (int y = 0; y < yDim; y++)
            {
                for (int x = 0; x < xDim; x++)
                {
                    SimpleUIntControl uic = new SimpleUIntControl();
                    uic.Text = "1";
                    //uic.ValueHasChanged += new SimpleUIntControl.SimpleUintControlValueChanged(ValueHasChanged);
                    //uic.ReturnKeyPressed += new SimpleUIntControl.SimpleUintControlReturnKeyHandler(ReturnKeyPressed);
                    uic.EventHandler += new SimpleUIntControl.SimpleUintControlEventHandler(HandleSimpleUIntControlEvent);
                    TableLayoutPanel.Controls.Add(uic, x, y);
                }
            }
            TableLayoutPanel.Location = new Point(_yLabelsWidth, _xLabelsHeight);
            //TableLayoutPanel.Width = _yLabelsWidth + ((_cellWidth + 1) * xDim);
            //TableLayoutPanel.Height = _xLabelsHeight + ((_cellHeight + 1) * yDim);
            this.ResumeLayout();
        }
コード例 #2
0
ファイル: UIntTable.cs プロジェクト: suvjunmd/Moritz
        public UIntTable(int xDim, int yDim,
			ModulationInputKrystal xInputKrystal, ModulationInputKrystal yInputKrystal)
        {
            InitializeComponent();

            _missingXValues = xInputKrystal.MissingAbsoluteValues;
            _missingYValues = yInputKrystal.MissingAbsoluteValues;

            if ((xDim < xInputKrystal.MaxValue) || (yDim < yInputKrystal.MaxValue))
            {
                string msg = "Table size exceeded."
                    + "\nThe maximum number of rows is " + yDim.ToString()
                    + "\nThe maximum number of columns is " + xDim.ToString();
                throw new ApplicationException(msg);
            }

            if(xDim > xInputKrystal.MaxValue)
                for(int i = (int) xInputKrystal.MaxValue + 1 ; i <= xDim ; i++)
                    _missingXValues.Add(i);
            if(yDim > yInputKrystal.MaxValue)
                for(int i = (int) yInputKrystal.MaxValue + 1 ; i <= yDim ; i++)
                    _missingYValues.Add(i);

            this.SuspendLayout();
            XDim = xDim;
            YDim = yDim;
            for (int y = 0; y < yDim; y++)
                for (int x = 0; x < xDim; x++)
                {
                    SimpleUIntControl uic = new SimpleUIntControl();
                    uic.Text = "1";
                    //uic.ValueHasChanged += new SimpleUIntControl.SimpleUintControlValueChanged(ValueHasChanged);
                    //uic.ReturnKeyPressed += new SimpleUIntControl.SimpleUintControlReturnKeyHandler(ReturnKeyPressed);
                    uic.EventHandler += new SimpleUIntControl.SimpleUintControlEventHandler(HandleSimpleUIntControlEvent);
                    TableLayoutPanel.Controls.Add(uic, x, y);
                }
            TableLayoutPanel.Location = new Point(_yLabelsWidth, _xLabelsHeight);
            //TableLayoutPanel.Width = _yLabelsWidth + ((_cellWidth + 1) * xDim);
            //TableLayoutPanel.Height = _xLabelsHeight + ((_cellHeight + 1) * yDim);
            this.ResumeLayout();
        }