Add image to Label and set ImageAlign to MiddleRight : Label « GUI Windows Form « C# / C Sharp

C# / C Sharp
1. 2D Graphics
2. Collections Data Structure
3. Components
4. Database ADO.net
5. Development Class
6. Event
7. File Stream
8. GUI Windows Form
9. Language Basics
10. Network
11. Office
12. Regular Expressions
13. Services Event
14. Thread
15. Web Services
16. Windows
17. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
C# / C Sharp » GUI Windows Form » LabelScreenshots 
Add image to Label and set ImageAlign to MiddleRight
Add image to Label and set ImageAlign to MiddleRight


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
{
    private System.Windows.Forms.Label label1;

  public Form1() {
        InitializeComponent();
  }

    private void InitializeComponent()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.SuspendLayout();

        this.label1.Image = new Bitmap("winter.jpg");
        this.label1.ImageAlign = System.Drawing.ContentAlignment.TopRight;
        this.label1.Location = new System.Drawing.Point(209);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(10577);
        this.label1.TabIndex = 0;
        this.label1.Text = "label1";

        this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(299271);

        this.Controls.Add(this.label1);
        this.Font = new System.Drawing.Font("Tahoma"8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.Name = "ImagesInCommonControls";
        this.Text = "ImagesInCommonControls";
        this.ResumeLayout(false);

    }

  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.Run(new Form1());
  }

}


           
       
Related examples in the same category
1. Label grows as the inner textLabel grows as the inner text
2. Label auto resizeLabel auto resize
3. Set Label Background, foreground color and border styleSet Label Background, foreground color and border style
4. Marquee Label HostMarquee Label Host
w_w___w__.___j_a_v_a_2s.___c__o___m___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.