示例#1
0
        // ******************************************************************
        protected override void OnPaint(PaintEventArgs e)
        {
            //base.OnPaint(e);
            SolidBrush   sb = new SolidBrush(this.BackColor);
            StringFormat sf = new StringFormat();

            sf.Alignment     = StringAlignment.Near;
            sf.LineAlignment = StringAlignment.Center;
            Graphics g = e.Graphics;

            try
            {
                g.FillRectangle(sb, this.ClientRectangle);
                sb.Color = this.ForeColor;
                Rectangle rct = new Rectangle(0, 0, m_AlgWidth, this.Height);
                g.DrawString(WizData.AlgString(m_Alg)[0] + "-", this.Font, sb, rct, sf);
                rct = new Rectangle(m_AlgWidth, 0, m_ClassWidth, this.Height);
                g.DrawString(WizData.ClassString(m_Class), this.Font, sb, rct, sf);
                rct = new Rectangle(m_AlgWidth + m_ClassWidth, 0, m_RaceWidth, this.Height);
                g.DrawString(WizData.RaceString(m_Race), this.Font, sb, rct, sf);
            }
            finally
            {
                sb.Dispose();
                sf.Dispose();
            }
        }
示例#2
0
        // ******************************************************************
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            int x = e.X;

            if (x < m_AlgWidth)
            {
                if (IsEditAlg)
                {
                    WizComboBox cmb = new WizComboBox();
                    int         ox  = cmb.OffsetPoint.X;
                    int         oy  = cmb.OffsetPoint.Y;
                    cmb.Name     = "A";
                    cmb.Location = new Point(this.Left - ox, this.Top - oy);
                    cmb.Size     = new Size(100, this.Height * 3);
                    for (int i = 0; i < WizData.AlgStr.Length; i++)
                    {
                        cmb.Add(WizData.AlgString((WIZALG)i));
                    }
                    cmb.SelectedIndex   = (int)m_Alg;
                    cmb.IsListMode      = true;
                    cmb.VisibleChanged += CmbAlg_VisibleChanged;
                    this.Parent.Controls.Add(cmb);
                    cmb.BringToFront();
                    cmb.Visible = true;
                }
            }
            else if (x < (m_AlgWidth + m_ClassWidth))
            {
                if (IsEditClass)
                {
                    WizComboBox cmb = new WizComboBox();
                    int         ox  = cmb.OffsetPoint.X;
                    int         oy  = cmb.OffsetPoint.Y;
                    cmb.Name     = "A";
                    cmb.Location = new Point(this.Left - ox + m_AlgWidth, this.Top - oy);
                    cmb.Size     = new Size(55, this.Height * 3);
                    for (int i = 0; i < WizData.ClassStr.Length; i++)
                    {
                        cmb.Add(WizData.ClassString((WIZCLASS)i));
                    }
                    cmb.SelectedIndex   = (int)m_Class;
                    cmb.IsListMode      = true;
                    cmb.VisibleChanged += CmbClass_VisibleChanged;
                    this.Parent.Controls.Add(cmb);
                    cmb.BringToFront();
                    cmb.Visible = true;
                }
            }
            else if (x < (m_AlgWidth + m_ClassWidth + m_RaceWidth))
            {
                if (IsEditRace)
                {
                    WizComboBox cmb = new WizComboBox();
                    int         ox  = cmb.OffsetPoint.X;
                    int         oy  = cmb.OffsetPoint.Y;
                    cmb.Name     = "A";
                    cmb.Location = new Point(this.Left - ox + m_AlgWidth + m_ClassWidth, this.Top - oy);
                    cmb.Size     = new Size(70, this.Height * 5);
                    for (int i = 0; i < WizData.RaceStr.Length; i++)
                    {
                        cmb.Add(WizData.RaceString((WIZRACE)i));
                    }
                    cmb.SelectedIndex   = (int)m_Race;
                    cmb.IsListMode      = true;
                    cmb.VisibleChanged += CmbRace_VisibleChanged;
                    this.Parent.Controls.Add(cmb);
                    cmb.BringToFront();
                    cmb.Visible = true;
                }
            }
        }