Example #1
0
        /// <summary>
        /// Creates Wrapper
        /// </summary>
        /// <param name="label">Wrapped label</param>
        /// <param name="icon">Icon</param>
        /// <param name="changeSize">The "change size" sign</param>
        /// <returns>Wrapper</returns>
        internal static UserControlLabel CreateLabel(IObjectLabel label, object icon, bool changeSize)
        {
            UserControlLabel l = new UserControlLabel();

            if (changeSize)
            {
                if (label is Control)
                {
                    Control c = label as Control;
                    if (c.Width > l.panelCenter.Width)
                    {
                        l.Width += c.Width - l.panelCenter.Width;
                    }
                    if (c.Height > l.panelCenter.Height)
                    {
                        l.Height += c.Height - l.panelCenter.Height;
                    }
                }
            }
            Image ic = icon as Image;

            if (ic == null)
            {
                if (label is INonstandardLabel)
                {
                    INonstandardLabel nl = label as INonstandardLabel;
                    ic = nl.Image as Image;
                }
            }
            l.icon = ic;
            l.pictureBoxIcon.Image = l.image;
            IProperties p = l;

            p.Properties = label;
            if (label is Control)
            {
                Control c = label as Control;
                c.Parent = l.panelCenter;
            }
            return(l);
        }
 /// <summary>
 /// Creates User control label
 /// </summary>
 /// <param name="changeSize">The "change size" sign</param>
 /// <returns>The label</returns>
 public UserControlLabel Create(bool changeSize)
 {
     return(UserControlLabel.CreateLabel(this, icon, changeSize));
 }