Esempio n. 1
0
        protected void LayoutComponent()
        {
            this.SuspendLayout();
            float[] xOffset = m_sPrinterProperty.GetXOffset();
            float[] yOffset = m_sPrinterProperty.get_YOffset();

            for (int i = 0; i < m_nButtonNum; i++)
            {
                RadioButton radio = this.m_radioButtonPointer[i];

                ControlClone.RadioButtonClone(radio, m_RadioButtonSample);
                //this.m_RadioButtonSample.Appearance = System.Windows.Forms.Appearance.Button;
                //this.m_RadioButtonSample.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                //this.m_RadioButtonSample.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

                radio.Size     = new Size(this.m_nButtonWidth, this.m_nButtonHeight);
                radio.Visible  = true;
                radio.TabIndex = m_RadioButtonSample.TabIndex + i;
                radio.Tag      = i;

                int   groupIndex = i / m_sPrinterProperty.nColorNum;
                int   colorIndex = i % m_sPrinterProperty.nColorNum;
                Point locate;
                if (m_bZeroSpace)
                {
                    locate = new Point(this.Width - m_Margin - (int)(m_Scale * i) - this.m_nButtonWidth,
                                       this.m_nButtonHeight * groupIndex + m_Margin);
                }
                else
                {
                    locate = new Point(this.Width - m_Margin - (int)(m_Scale * xOffset[i]) - this.m_nButtonWidth,
                                       (int)(m_Scale * yOffset[colorIndex]) + this.m_nButtonHeight * groupIndex + m_Margin);
                }
                if (m_bScaleMin_Y)
                {
                    locate.X += m_MarginMiddle;
                }
                else
                {
                    locate.Y += m_MarginMiddle;
                }

                radio.Location  = locate;
                radio.BackColor = m_sPrinterProperty.GetButtonColor(colorIndex);
                //radio.Paint += new PaintEventHandler(m_radioButtonExample_Paint);
                radio.CheckedChanged += new System.EventHandler(this.m_RadioButtonSample_CheckedChanged);
            }
        }