Exemple #1
0
        public void SetChannel(DmxFramework.Channels.Channel pChannel)
        {
            float pourcentage = 0;

            mChannel = pChannel;
            this.checkBox1.Checked = mChannel.IsForced;
            this.checkBox1.Text    = mChannel.Name;
            this.tableLayoutPanel1.Controls.Clear();
            this.tableLayoutPanel1.RowCount    = 0;
            this.tableLayoutPanel1.ColumnCount = 0;

            //set row ...
            pourcentage = 100 / mChannel.RowCount;
            this.tableLayoutPanel1.RowStyles.Clear();
            this.tableLayoutPanel1.RowCount = mChannel.RowCount;
            for (int i = 0; i < mChannel.RowCount; i++)
            {
                this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, pourcentage));
            }

            //set columns ...
            pourcentage = 100 / mChannel.ColumnCount;
            this.tableLayoutPanel1.ColumnStyles.Clear();
            this.tableLayoutPanel1.ColumnCount = mChannel.ColumnCount;
            for (int i = 0; i < mChannel.ColumnCount; i++)
            {
                this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, pourcentage));
            }


            int count = 0;

            for (int i = 0; i < mChannel.RowCount; i++)
            {
                for (int j = 0; j < mChannel.ColumnCount; j++)
                {
                    if (count >= mChannel.DmxValues.Count)
                    {
                        break;
                    }
                    ValueButton btn = new ValueButton((DmxFramework.Channels.DmxValue)mChannel.DmxValues[count]);
                    btn.OnNewBtnValue += new OnNewBtnValueHandler(btn_OnNewBtnValue);

                    btn.Dock      = System.Windows.Forms.DockStyle.Fill;
                    btn.FlatStyle = System.Windows.Forms.FlatStyle.Popup;

                    this.tableLayoutPanel1.Controls.Add(btn, j, i);
                    count++;
                }
            }
            mChannel_OnValueChanged(mChannel, mChannel.Value);

            if (Main.Options.Visualize)
            {
                mChannel.OnValueChanged += new DmxFramework.Channels.OnValueChangedHandler(mChannel_OnValueChanged);
            }
            mChannel.OnForcedStateChanged += new DmxFramework.Channels.OnForcedStateChangedHandler(mChannel_OnForcedStateChanged);
        }
Exemple #2
0
 void ChangeChannelValue(DmxFramework.Channels.Channel pChannel, int pValue)
 {
     for (int i = 0; i < this.tableLayoutPanel1.Controls.Count; i++)
     {
         ValueButton btn = (ValueButton)this.tableLayoutPanel1.Controls[i];
         if (btn.IsConcerned(pValue))
         {
             btn.SetSelectedMode(true);
         }
         else
         {
             btn.SetSelectedMode(false);
         }
     }
 }