Image display problem in ListView 'small icon' mode.

S

Steve

Hi;
I added a ListView and ImageList in a form. I also added an image in the
'itmes' property. However, the color of image is wrong.

I tested the image with pictureBox. It displays the image correctly.

The following is the copy of the Form.designer.cs
=====================
//
// imageListServerLamp
//
this.imageListServerLamp.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListServerLamp.ImageStream")));
this.imageListServerLamp.TransparentColor =
System.Drawing.Color.Transparent;
this.imageListServerLamp.Images.SetKeyName(0, "¨}¦n 25X25.png");
this.imageListServerLamp.Images.SetKeyName(1, "¥¿±` 25X25.png");
this.imageListServerLamp.Images.SetKeyName(2, "¾ÖÀ½ 25X25.png");
this.imageListServerLamp.Images.SetKeyName(3, "Â÷½u 25X25.png");
//
// listViewServerLamp
//
this.listViewServerLamp.BackColor = System.Drawing.SystemColors.Info;
this.listViewServerLamp.BorderStyle =
System.Windows.Forms.BorderStyle.None;
this.listViewServerLamp.Items.AddRange(new
System.Windows.Forms.ListViewItem[] {
listViewItem1});
this.listViewServerLamp.Location = new System.Drawing.Point(658, 463);
this.listViewServerLamp.Name = "listViewServerLamp";
this.listViewServerLamp.Size = new System.Drawing.Size(84, 100);
this.listViewServerLamp.SmallImageList = this.imageListServerLamp;
this.listViewServerLamp.TabIndex = 5;
this.listViewServerLamp.UseCompatibleStateImageBehavior = false;
this.listViewServerLamp.View = System.Windows.Forms.View.SmallIcon;
//
// pictureBox1
//
this.pictureBox1.Image =
((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(719, 472);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(57, 47);
this.pictureBox1.TabIndex = 6;
this.pictureBox1.TabStop = false;
============================================
thank you.

steve
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi;
I added a ListView and ImageList in a form. I also added an image in the
'itmes' property. However, the color of image is wrong.

I tested the image with pictureBox. It displays the image correctly.

The following is the copy of the Form.designer.cs
=====================
      //
      // imageListServerLamp
      //
      this.imageListServerLamp.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListServerLamp.ImageStream")));
      this.imageListServerLamp.TransparentColor =
System.Drawing.Color.Transparent;
      this.imageListServerLamp.Images.SetKeyName(0, "¨}¦n 25X25..png");
      this.imageListServerLamp.Images.SetKeyName(1, "¥¿±` 25X25.png");
      this.imageListServerLamp.Images.SetKeyName(2, "¾ÖÀ½ 25X25.png");
      this.imageListServerLamp.Images.SetKeyName(3, "Â÷½u 25X25.png");
      //
      // listViewServerLamp
      //
      this.listViewServerLamp.BackColor = System.Drawing.SystemColors.Info;
      this.listViewServerLamp.BorderStyle =
System.Windows.Forms.BorderStyle.None;
      this.listViewServerLamp.Items.AddRange(new
System.Windows.Forms.ListViewItem[] {
            listViewItem1});
      this.listViewServerLamp.Location = new System.Drawing.Point(658, 463);
      this.listViewServerLamp.Name = "listViewServerLamp";
      this.listViewServerLamp.Size = new System.Drawing.Size(84, 100);
      this.listViewServerLamp.SmallImageList = this.imageListServerLamp;
      this.listViewServerLamp.TabIndex = 5;
      this.listViewServerLamp.UseCompatibleStateImageBehavior = false;
      this.listViewServerLamp.View = System.Windows.Forms.View.SmallIcon;
      //
      // pictureBox1
      //
      this.pictureBox1.Image =
((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
      this.pictureBox1.Location = new System.Drawing.Point(719, 472);
      this.pictureBox1.Name = "pictureBox1";
      this.pictureBox1.Size = new System.Drawing.Size(57, 47);
      this.pictureBox1.TabIndex = 6;
      this.pictureBox1.TabStop = false;
============================================
thank you.

steve

It might be possible that the size of the image is being changed and
that change the color, what color differences are you seeing?
 
Top