コード例 #1
0
 protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
 {
     base.OnDrawColumnHeader(e);
     if (e.ColumnIndex == 0)
     {
         var headerCheckBox = new CheckBox {Text = "", Visible = true};
         SuspendLayout();
         e.DrawBackground();
         headerCheckBox.BackColor = Color.Transparent;
         headerCheckBox.UseVisualStyleBackColor = true;
         headerCheckBox.BackgroundImage = Resources.ListViewHeaderCheckboxBackgroud;
         headerCheckBox.SetBounds(e.Bounds.X, e.Bounds.Y,
                                  headerCheckBox.GetPreferredSize(new Size(e.Bounds.Width, e.Bounds.Height)).
                                      Width,
                                  headerCheckBox.GetPreferredSize(new Size(e.Bounds.Width, e.Bounds.Height)).
                                      Height);
         headerCheckBox.Size =
             new Size(headerCheckBox.GetPreferredSize(new Size(e.Bounds.Width - 1, e.Bounds.Height)).Width + 1,
                      e.Bounds.Height);
         headerCheckBox.Location = new Point(4, 0);
         Controls.Add(headerCheckBox);
         headerCheckBox.Show();
         headerCheckBox.BringToFront();
         e.DrawText(TextFormatFlags.VerticalCenter | TextFormatFlags.Left);
         headerCheckBox.CheckedChanged += OnHeaderCheckboxCheckedChanged;
         ResumeLayout(true);
     }
     else
     {
         e.DrawDefault = true;
     }
 }
コード例 #2
0
ファイル: AgentGUI.cs プロジェクト: prezz/Fuzzy-Gammon
        public AgentGUI( string caption )
        {
            m_Id = ++m_IdCounter;
            RadioGroupUpdater[] tmpOld = m_UpdaterList;
            m_UpdaterList = new RadioGroupUpdater[m_Id];
            if ( tmpOld != null )
                for ( int i = 0; i < tmpOld.Length; i++ )
                    m_UpdaterList[i] = tmpOld[i];
            m_UpdaterList[m_Id-1] = new RadioGroupUpdater( SyncPlayerSelectors );

            this.Text = caption;
            this.Width = 430;
            this.Height = 340;
            this.MaximizeBox = false;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            m_GroupBoxPlayer = new GroupBox();
            m_GroupBoxPlayer.Text = "Play as";
            m_GroupBoxPlayer.Width = 100;
            m_GroupBoxPlayer.Height = 150;
            m_GroupBoxPlayer.Left = 10;
            m_GroupBoxPlayer.Top = 25;
            m_GroupBoxPlayer.Show();
            this.Controls.Add( m_GroupBoxPlayer );

            m_PlayerLight = new RadioButton();
            m_PlayerLight.Text = "Light";
            m_PlayerLight.Width = 50;
            m_PlayerLight.Left = 25;
            m_PlayerLight.Top = 50;
            m_PlayerLight.Checked = true;
            m_PlayerLight.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerLight.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerLight );

            m_PlayerDark = new RadioButton();
            m_PlayerDark.Text = "Dark";
            m_PlayerDark.Width = 50;
            m_PlayerDark.Left = 25;
            m_PlayerDark.Top = 80;
            m_PlayerDark.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerDark.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerDark );

            m_PlayerNone = new RadioButton();
            m_PlayerNone.Text = "None";
            m_PlayerNone.Width = 50;
            m_PlayerNone.Left = 25;
            m_PlayerNone.Top = 20;
            m_PlayerNone.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerNone.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerNone );

            m_PlayerBoth = new RadioButton();
            m_PlayerBoth.Text = "Both";
            m_PlayerBoth.Width = 50;
            m_PlayerBoth.Left = 25;
            m_PlayerBoth.Top = 110;
            m_PlayerBoth.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerBoth.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerBoth );

            m_EvaluatorLabel = new Label();
            m_EvaluatorLabel.Text = "Evaluator";
            m_EvaluatorLabel.Left = 10;
            m_EvaluatorLabel.Top = 190;
            m_EvaluatorLabel.AutoSize = true;
            m_EvaluatorLabel.Show();
            this.Controls.Add( m_EvaluatorLabel );

            m_PluginSelector = new ComboBox();
            m_PluginSelector.DropDownStyle = ComboBoxStyle.DropDownList;
            m_PluginSelector.Left = 10;
            m_PluginSelector.Top = 210;
            m_PluginSelector.Width = 100;
            m_PluginSelector.Items.Add( "None" );
            m_PluginSelector.SelectedIndex = 0;
            m_PluginSelector.Show();
            this.Controls.Add( m_PluginSelector );

            m_LearnPanel = new Panel();
            m_LearnPanel.BorderStyle = BorderStyle.None;
            m_LearnPanel.Left = 5;
            m_LearnPanel.Top = 240;
            m_LearnPanel.Width = 100;
            m_LearnPanel.Height = 25;
            m_LearnPanel.Show();
            this.Controls.Add( m_LearnPanel );

            m_Learn = new CheckBox();
            m_Learn.Text = "Learn";
            m_Learn.Left = 5;
            m_Learn.Top = 0;
            m_Learn.Checked = false;
            m_Learn.CheckedChanged += new EventHandler( m_Learn_CheckedChanged );
            m_Learn.Show();
            m_LearnPanel.Controls.Add( m_Learn );
            if (m_Id == 1)
                m_Learn.Checked = true;

            m_PossibilitiesLabel = new Label();
            m_PossibilitiesLabel.Text = "Possible moves and score";
            m_PossibilitiesLabel.Left = 130;
            m_PossibilitiesLabel.Top = 10;
            m_PossibilitiesLabel.AutoSize = true;
            m_PossibilitiesLabel.Show();
            this.Controls.Add( m_PossibilitiesLabel );

            m_PossibilitiesList = new ListBox();
            m_PossibilitiesList.Left = 130;
            m_PossibilitiesList.Top = 30;
            m_PossibilitiesList.Width = 280;
            m_PossibilitiesList.Height = 250;
            m_PossibilitiesList.Show();
            this.Controls.Add( m_PossibilitiesList );

            m_NumberPossibilitiesLabel = new Label();
            m_NumberPossibilitiesLabel.Text = "Possibilities: 0";
            m_NumberPossibilitiesLabel.Left = 130;
            m_NumberPossibilitiesLabel.Top = 280;
            m_NumberPossibilitiesLabel.AutoSize = true;
            m_NumberPossibilitiesLabel.Show();
            this.Controls.Add( m_NumberPossibilitiesLabel );

            SyncAllSelectors();
            SyncAllSelectors();
        }