Click here to Skip to main content
15,883,623 members
Articles / Programming Languages / C#

A Transparent/Translucent Label Control with Moving Caption

Rate me:
Please Sign up or sign in to vote.
4.35/5 (35 votes)
16 Aug 20072 min read 108.4K   3.4K   104  
This article describes the creation of a Label custom control that can be translucent to the background.
namespace DOALibrary
{
    partial class Form1
    {
        /// <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()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.panel1 = new System.Windows.Forms.Panel();
            this.doaTransparentLabel1 = new DOALibrary.DOATransparentLabel();
            this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel1.BackgroundImage")));
            this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.panel1.Controls.Add(this.doaTransparentLabel1);
            this.panel1.Location = new System.Drawing.Point(0, 1);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(391, 272);
            this.panel1.TabIndex = 1;
            // 
            // doaTransparentLabel1
            // 
            this.doaTransparentLabel1.BackColor = System.Drawing.Color.OliveDrab;
            this.doaTransparentLabel1.Caption = "My Lotus Car";
            this.doaTransparentLabel1.DimmedColor = System.Drawing.Color.Red;
            this.doaTransparentLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.doaTransparentLabel1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.doaTransparentLabel1.Location = new System.Drawing.Point(110, 199);
            this.doaTransparentLabel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.doaTransparentLabel1.Moving = DOALibrary.DOATransparentLabel.MoveType.DownToUp;
            this.doaTransparentLabel1.MovingActive = true;
            this.doaTransparentLabel1.Name = "doaTransparentLabel1";
            this.doaTransparentLabel1.Radius = 10;
            this.doaTransparentLabel1.ShapeBorderStyle = DOALibrary.DOATransparentLabel.ShapeBorderStyles.ShapeBSFixedSingle;
            this.doaTransparentLabel1.Size = new System.Drawing.Size(171, 54);
            this.doaTransparentLabel1.TabIndex = 0;
            // 
            // propertyGrid1
            // 
            this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Right;
            this.propertyGrid1.Location = new System.Drawing.Point(388, 0);
            this.propertyGrid1.Name = "propertyGrid1";
            this.propertyGrid1.Size = new System.Drawing.Size(281, 266);
            this.propertyGrid1.TabIndex = 2;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(669, 266);
            this.Controls.Add(this.propertyGrid1);
            this.Controls.Add(this.panel1);
            this.Name = "Form1";
            this.Text = "Transparent/Translucent Label";
            this.panel1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private DOALibrary.DOATransparentLabel doaTransparentLabel1;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.PropertyGrid propertyGrid1;
    }
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Argentina Argentina
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions