public void DrawIcon(Icon icon, int x, int y)
 {
     if (icon == null)
     {
         throw new ArgumentNullException("icon");
     }
     if (this.backingImage != null)
     {
         this.DrawImage(icon.ToBitmap(), x, y);
     }
     else
     {
         icon.Draw(this, x, y);
     }
 }
示例#2
0
        public void DrawIcon(Icon icon, Rectangle targetRect) {
            if (icon == null){
                throw new ArgumentNullException("icon");
            }

            if(this.backingImage != null) {
                // we don't call the icon directly because we want to stay in GDI+ all the time
                // to avoid alpha channel interop issues between gdi and gdi+
                // so we do icon.ToBitmap() and then we call DrawImage. this is probably slower...
                this.DrawImage(icon.ToBitmap(), targetRect);
            } 
            else {
                icon.Draw(this, targetRect);
            }
        }
 public void DrawIcon(Icon icon, Rectangle targetRect)
 {
     if (icon == null)
     {
         throw new ArgumentNullException("icon");
     }
     if (this.backingImage != null)
     {
         this.DrawImage(icon.ToBitmap(), targetRect);
     }
     else
     {
         icon.Draw(this, targetRect);
     }
 }