want to know following for help FOR WINDOW APPLICATION

Posted by Subhadip under C# on 1/8/2011 | Points: 10 | Views : 742 | Status : [Member] | Replies : 2
1. i have added a button in a form called SAVE ,CLOSE, now i want add image and along with text on button what is the code?(IN WINDOW APPLICATION)
2. I have added some of the list like apple,box,pen etc in drop down box and list box (IN WINDOW APPLICATION) now i want to show the image along with the item list what is the code??




Responses

Posted by: Karthikanbarasan on: 1/8/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Try this for image in a button along with text

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.Button button1;

public Form1() {
InitializeComponent();
}

private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();

this.button1.Image = new Bitmap("winter.jpg");
this.button1.ImageAlign = System.Drawing.ContentAlignment.TopRight;
this.button1.Location = new System.Drawing.Point(12, 99);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(132, 74);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.UseVisualStyleBackColor = true;

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(299, 271);

this.Controls.Add(this.button1);
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());
}

}


Thanks
Karthik
www.f5Debug.net

Subhadip, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/8/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

do you want to show the image in drop down list with list box??? or you want to show the image list names alone in the list????

Thanks
Karthik
www.f5Debug.net

Subhadip, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response