c# CollectionBase, I lost the design time collection after build....

Hi

I want to write a component is c# with collection.
It works fine, but if I create a nem collection item in desig time,I lost this value(s) when I go to the code view or build it.

I need a fast solution....

Here is the source code :
/*
 * Created by SharpDevelop.
 * User: xxxx
 * Date: 2004.11.19.
 * Time: 22:32
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Runtime.Serialization;
//using System.Collections;

namespace xBase
{
      /// <summary>
      /// Description of UserControl1.      
      /// </summary>
            
      public class Desktop : System.Windows.Forms.UserControl
      {
            private System.ComponentModel.IContainer components;
            private System.Windows.Forms.ImageList IconImageList;
            private System.Drawing.Bitmap BkGroundBitmap = null;      
            private Desktop.MyIconsCollection fIconList = new MyIconsCollection();
            
            public Desktop()
            {
                  //
                  // The InitializeComponent() call is required for Windows Forms designer support.
                  //
                  InitializeComponent();
                  
                  //
                  // TODO: Add constructor code after the InitializeComponent() call.
                  //
            }
            
            protected override void OnResize(EventArgs e)
            {
                  Invalidate();
            }
                        
            protected override void OnPaint( PaintEventArgs pe )
            {
                  Graphics g = pe.Graphics;
                  Rectangle rect = this.ClientRectangle;
                  if (BkGroundBitmap != null)
                  {
                        g.DrawImage(BkGroundBitmap, rect);
                  } else
                  {
                        g.Clear(this.BackColor);
                  }
                  
                  if (fIconList != null)
                  {
                     if (fIconList.Count > 0)
                     {
                                 for (int a=0;a<=fIconList.Count-1;a++)
                                 {
                                       try
                                       {
                                             if ((IconImageList.Images.Count-1 >= fIconList[a].Index) && (IconImageList.Images.Count>0))
                                             {
                                                   Image IconBitmap = IconImageList.Images[fIconList[a].Index];
                                                   Bitmap bmIcon = (Bitmap)IconBitmap;
                                                   bmIcon.MakeTransparent(bmIcon.GetPixel(1,1));
                                                   g.DrawImage(bmIcon,fIconList[a].XPosition,fIconList[a].YPosition,IconBitmap.Width,IconBitmap.Height);
                                             }
                                       }
                                       catch
                                       {}
                                 }
                     }
                }
            }
            
            public ImageList IconImages
            {
                  set      {IconImageList = value; Invalidate();}
                  get {return IconImageList;}
      
            }
            public Bitmap BackGroundBitmap
            {
                  set {BkGroundBitmap = value; Invalidate();}
                  get {return BkGroundBitmap;}
            }
            
            [
            DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
            EditorAttribute("System.ComponentModel.Design.CollectionEditor", "System.Drawing.Design.UITypeEditor")
            ]
            public Desktop.MyIconsCollection Iconlist
            {
                  get
                  {
                        if (this.fIconList == null)
                        {
                              this.fIconList = new Desktop.MyIconsCollection();
                        }
                        return this.fIconList;
                  }
            }
            

            ///
            /// Collection
            ///
            
            public sealed class Icons : Component
            {
                  private string IconCaption;
                  private int IconIndex;
                  private int IconXPosition;
                  private int IconYPosition;
                  
                  public Icons()
                  {
                        
                  }
                  
                  //[Browsable(false)]
                  public string Caption
                  {
                        set { IconCaption = value;}
                        get { return IconCaption;}
                  }
                  public int XPosition
                  {
                        set { IconXPosition = value;}
                        get { return IconXPosition;}
                  }
                  public int YPosition
                  {
                        set { IconYPosition = value;}
                        get { return IconYPosition;}
                  }
                  public int Index
                  {
                        set { IconIndex = value;}
                        get { return IconIndex;}
                  }
                  
            }
          
          [Serializable]
          public sealed class MyIconsCollection : System.Collections.CollectionBase
            {
                  public int Add(Icons item)
                  {
                        return List.Add(item);
                  }
                  public void Insert(int index, Icons item)
                  {
                        List.Insert(index,item);
                  }
                  public void Remove(Icons item)
                  {
                        List.Remove(item);
                  }
                  public bool Contains(Icons item)
                  {
                        return List.Contains(item);
                  }
                  public int IndexOf(Icons item)
                  {
                        return List.IndexOf(item);
                  }
                  public void CopyTo(Icons[] array,int index)
                  {
                        List.CopyTo(array,index);
                  }
                  public Icons this[int index]
                  {
                        get {return(Icons)List[index];}
                        set {List[index] = value;}
                  }
            }
            
            #region Windows Forms Designer generated code
            /// <summary>
            /// This method is required for Windows Forms designer support.
            /// Do not change the method contents inside the source code editor. The Forms designer might
            /// not be able to load this method if it was changed manually.
            /// </summary>
            private void InitializeComponent() {
                  this.components = new System.ComponentModel.Container();
                  this.IconImageList = new System.Windows.Forms.ImageList(this.components);
                  //
                  // IconImageList
                  //
                  this.IconImageList.ImageSize = new System.Drawing.Size(16, 16);
                  this.IconImageList.TransparentColor = System.Drawing.Color.Transparent;
                  //
                  // Desktop
                  //
                  this.Name = "Desktop";
                  this.Size = new System.Drawing.Size(292, 266);
            }
            #endregion
      }
}
wwwbetyarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tomvergoteCommented:
maybe there's a bug in sharpdevelop's designer?

Are you using their latest version?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wwwbetyarAuthor Commented:
yes I use the lastest version so I"m not sure that is the bug.
0
tomvergoteCommented:
I think you should try posting this to the sharpdevelop forums or mailinglists as it seems clear that it's something with their designer.
You create a collection in design view and it isn't reflected in code.
0
wwwbetyarAuthor Commented:
I tryed it in visual studio !
It works fine , so I will write  to the sharpdevelop forums....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.