Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

Windowsform like control panel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
stbo66 - 22 Dec 2006 08:08 GMT
Any sample on how to create
a windows form like windows xp control panel ?

Happy Holiday

Stefano
Jason Hales - 22 Dec 2006 09:53 GMT
The main list of items uses a ListView (default View property should be
View.Details).  To get the icons you'll need two ImageList controls -
one for small and one for large icons - setting the LargeImageList and
SmallImageList accordingly.

Use the overload of listView.Items.Add which allows you to pass in
string of subitems and and image index for different images

public class Form1 : Form
{

   private System.ComponentModel.IContainer components = null;
   private System.Windows.Forms.ListView listView;
   private System.Windows.Forms.ColumnHeader columnHeader1;
   private System.Windows.Forms.ColumnHeader columnHeader2;
   private System.Windows.Forms.ImageList imageList;

   public Form1()
   {
       InitializeComponent();

       listView.Items.Add(new ListViewItem(new string[] {"Add
hardware", "Installs and troubleshoots"}, 0));
       listView.Items.Add(new ListViewItem(new string[] { "Admin
tools", "Configure" }, 1));
   }

   private void InitializeComponent()
   {
       this.components = new System.ComponentModel.Container();
       System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(Form1));
       this.listView = new System.Windows.Forms.ListView();
       this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
       this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
       this.imageList = new
System.Windows.Forms.ImageList(this.components);
       this.SuspendLayout();
       //
       // listView
       //
       this.listView.Columns.AddRange(new
System.Windows.Forms.ColumnHeader[] {
       this.columnHeader1,
       this.columnHeader2});
       this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
       this.listView.LargeImageList = this.imageList;
       this.listView.Location = new System.Drawing.Point(4, 4);
       this.listView.Name = "listView";
       this.listView.Size = new System.Drawing.Size(284, 265);
       this.listView.SmallImageList = this.imageList;
       this.listView.TabIndex = 0;
       this.listView.UseCompatibleStateImageBehavior = false;
       this.listView.View = System.Windows.Forms.View.List;
       this.listView.DoubleClick += new
System.EventHandler(this.listView_DoubleClick);
       //
       // columnHeader1
       //
       this.columnHeader1.Text = "Name";
       this.columnHeader1.Width = 115;
       //
       // columnHeader2
       //
       this.columnHeader2.Text = "Comments";
       this.columnHeader2.Width = 153;
       //
       // imageList
       //
       this.imageList.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
       this.imageList.TransparentColor =
System.Drawing.Color.Transparent;
       this.imageList.Images.SetKeyName(0, "");
       this.imageList.Images.SetKeyName(1, "ActualSize.bmp");
       //
       // Form1
       //
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(292, 273);
       this.Controls.Add(this.listView);
       this.Name = "Form1";
       this.Padding = new System.Windows.Forms.Padding(4);
       this.Text = "Form1";
       this.ResumeLayout(false);

   }

   protected override void Dispose(bool disposing)
   {
       if (disposing && (components != null))
       {
           components.Dispose();
       }
       base.Dispose(disposing);
   }

   private void listView_DoubleClick(object sender, EventArgs e)
   {
       if ((int)listView.View < 4)
       {
           listView.View = (View)(listView.View + 1);
       }
       else
       {
           listView.View = 0;
       }
   }
}
hasan - 02 Feb 2007 15:53 GMT
iam soorry

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.