Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/25/10 00:29:17 (14 years ago)
Author:
swagner
Message:

Enabled hiding details in all collection views (#1095)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r4068 r4096  
    2121
    2222using System;
    23 using System.Drawing;
    2423using System.Windows.Forms;
    2524using HeuristicLab.Common;
     
    6463        this.Invoke(new EventHandler(Content_Changed), sender, e);
    6564      else
    66         UpdateColorPictureBox();
     65        UpdateColor();
    6766    }
    6867
     
    7170      viewHost.Content = null;
    7271      if (Content != null)
    73         UpdateColorPictureBox();
     72        UpdateColor();
    7473      FillListView();
    7574    }
     
    8887      }
    8988    }
    90     private void UpdateColorPictureBox() {
     89    private void UpdateColor() {
    9190      this.colorDialog.Color = this.Content.Color;
    92       this.colorPictureBox.Image = this.GenerateImage(colorPictureBox.Width, colorPictureBox.Height, this.Content.Color);
    93     }
    94     private Image GenerateImage(int width, int height, Color fillColor) {
    95       Image colorImage = new Bitmap(width, height);
    96       using (Graphics gfx = Graphics.FromImage(colorImage)) {
    97         using (SolidBrush brush = new SolidBrush(fillColor)) {
    98           gfx.FillRectangle(brush, 0, 0, width, height);
    99         }
    100       }
    101       return colorImage;
     91      this.colorArea.BackColor = this.Content.Color;
    10292    }
    10393
     
    132122
    133123    private void listView_SelectedIndexChanged(object sender, EventArgs e) {
    134       if (listView.SelectedItems.Count == 1)
    135         viewHost.Content = (IContent)listView.SelectedItems[0].Tag;
    136       else
    137         viewHost.Content = null;
     124      if (showDetailsCheckBox.Checked) {
     125        if (listView.SelectedItems.Count == 1) {
     126          detailsGroupBox.Enabled = true;
     127          viewHost.Content = listView.SelectedItems[0].Tag as IContent;
     128        } else {
     129          viewHost.Content = null;
     130          detailsGroupBox.Enabled = false;
     131        }
     132      }
    138133    }
    139134    private void listView_DoubleClick(object sender, EventArgs e) {
     
    159154      }
    160155    }
     156    private void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
     157      if (showDetailsCheckBox.Checked) {
     158        splitContainer.Panel2Collapsed = false;
     159        detailsGroupBox.Enabled = listView.SelectedItems.Count == 1;
     160        viewHost.Content = listView.SelectedItems.Count == 1 ? (IContent)listView.SelectedItems[0].Tag : null;
     161      } else {
     162        splitContainer.Panel2Collapsed = true;
     163        viewHost.Content = null;
     164        viewHost.ClearCache();
     165      }
     166    }
    161167    private void showAlgorithmButton_Click(object sender, EventArgs e) {
    162168      if (!Locked) {
Note: See TracChangeset for help on using the changeset viewer.