Click here to Skip to main content
15,886,519 members
Articles / Desktop Programming / Windows Forms

How to Use Transparent Images and Labels in Windows Forms

Rate me:
Please Sign up or sign in to vote.
4.61/5 (33 votes)
8 Apr 2008CPOL4 min read 308.2K   12.2K   119  
The controls in Windows Forms (.NET) don't support true transparency. In this article, we show how to use transparent labels and images.
namespace WindowsApplication1
{
    partial class TransparentImagesTextForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.broculosDrawing1 = new BroculosDrawing();
            this.SuspendLayout();
            // 
            // broculosDrawing1
            // 
            this.broculosDrawing1.Location = new System.Drawing.Point(12, 12);
            this.broculosDrawing1.Name = "broculosDrawing1";
            this.broculosDrawing1.Size = new System.Drawing.Size(207, 205);
            this.broculosDrawing1.TabIndex = 0;
            // 
            // TransparentImagesTextForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(272, 239);
            this.Controls.Add(this.broculosDrawing1);
            this.Name = "TransparentImagesTextForm";
            this.Text = "Transparent Images and Text";
            this.ResumeLayout(false);

        }

        #endregion

        private BroculosDrawing broculosDrawing1;

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Portugal Portugal
Find more of my tutorials at Broculos.net.

Comments and Discussions