Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/24/11 01:40:34 (13 years ago)
Author:
abeham
Message:

#1330

  • fixed a small bug in a view
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPView.cs

    r5811 r5820  
    173173
    174174    private void GenerateImage() {
    175       Bitmap newBitmap = null;
    176       stressLabel.Text = "-";
    177       if (distancesRadioButton.Checked && Distances != null && Distances.Rows > 0
    178         && Distances.Rows == Distances.Columns) {
    179         if (Distances.Rows > 30) {
    180           newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
    181           WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension too large for visualization.");
    182         } else newBitmap = GenerateDistanceImage();
    183       } else if (weightsRadioButton.Checked && Weights != null && Weights.Rows > 0
    184         && Weights.Rows == Weights.Columns) {
    185         if (Weights.Rows > 30) {
    186           newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
    187           WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension too large for visualization.");
    188         } else newBitmap = GenerateWeightsImage();
    189       } else if (assignmentRadioButton.Checked
    190         && Assignment != null && Assignment.Length > 0
    191         && Weights != null && Weights.Rows > 0
    192         && Distances != null && Distances.Rows > 0
    193         && Weights.Rows == Weights.Columns
    194         && Distances.Rows == Distances.Columns
    195         && Assignment.Length == Weights.Rows
    196         && Assignment.Length == Distances.Rows
    197         && Assignment.Validate()) {
    198         newBitmap = GenerateAssignmentImage();
    199       }
    200 
    201       pictureBox.Image = newBitmap != null ? newBitmap : defaultBitmap;
    202       if (bitmap != null) bitmap.Dispose();
    203       if (newBitmap != null) bitmap = newBitmap;
    204       else bitmap = null;
     175      if (pictureBox.Width > 0 && pictureBox.Height > 0) {
     176        Bitmap newBitmap = null;
     177        stressLabel.Text = "-";
     178        if (distancesRadioButton.Checked && Distances != null && Distances.Rows > 0
     179          && Distances.Rows == Distances.Columns) {
     180          if (Distances.Rows > 30) {
     181            newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
     182            WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension too large for visualization.");
     183          } else newBitmap = GenerateDistanceImage();
     184        } else if (weightsRadioButton.Checked && Weights != null && Weights.Rows > 0
     185          && Weights.Rows == Weights.Columns) {
     186          if (Weights.Rows > 30) {
     187            newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
     188            WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension too large for visualization.");
     189          } else newBitmap = GenerateWeightsImage();
     190        } else if (assignmentRadioButton.Checked
     191          && Assignment != null && Assignment.Length > 0
     192          && Weights != null && Weights.Rows > 0
     193          && Distances != null && Distances.Rows > 0
     194          && Weights.Rows == Weights.Columns
     195          && Distances.Rows == Distances.Columns
     196          && Assignment.Length == Weights.Rows
     197          && Assignment.Length == Distances.Rows
     198          && Assignment.Validate()) {
     199          if (Assignment.Length > 30) {
     200            newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
     201            WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension too large for visualization.");
     202          } else newBitmap = GenerateAssignmentImage();
     203        }
     204
     205        pictureBox.Image = newBitmap != null ? newBitmap : defaultBitmap;
     206        if (bitmap != null) bitmap.Dispose();
     207        if (newBitmap != null) bitmap = newBitmap;
     208        else bitmap = null;
     209      }
    205210    }
    206211
Note: See TracChangeset for help on using the changeset viewer.