Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button and Images
Message
From
28/09/2004 09:51:27
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00946621
Message ID:
00946648
Views:
12
Shawn,

You don't need to have a lot of the extra stuff you have in this class. you can keep it a lot simpler than that. Try something like this instead:
using System;
using System.Collections;
using System.Diagnostics;

namespace Apps4u.WinApp.Controls.Buttons
{
	/// <summary>
	/// Summary description for a4uButtonGetFolder.
	/// </summary>
	public class a4uButtonGetFolder : Apps4u.WinApp.Controls.Buttons.a4uButton
	{
		public a4uButtonGetFolder()
		{
			this.Image = System.Drawing.Image.FromFile("c:\\MyImage.ico");
			this.Text = "";
		}
	}
}
~~Bonnie

>How do i add an image to a base class button and have the image show up when i drop it on a form in the designer.
>
>Since i can't set the properties through the properties window how do i do this in code.
>
>This is what i have so far :
>
>
>using System;
>using System.ComponentModel;
>using System.Collections;
>using System.Diagnostics;
>
>namespace Apps4u.WinApp.Controls.Buttons
>{
>	/// <summary>
>	/// Summary description for a4uButtonGetFolder.
>	/// </summary>
>	public class a4uButtonGetFolder : Apps4u.WinApp.Controls.Buttons.a4uButton
>	{
>		public System.Windows.Forms.ImageList ButtonImageList;
>		public System.ComponentModel.IContainer components;
>
>		public a4uButtonGetFolder(System.ComponentModel.IContainer container)
>		{
>			///
>			/// Required for Windows.Forms Class Composition Designer support
>			///
>			container.Add(this);
>			container.Add(this.ButtonImageList);
>			InitializeComponent();
>
>			//
>			// TODO: Add any constructor code after InitializeComponent call
>			//
>		}
>
>		public a4uButtonGetFolder()
>		{
>			///
>			/// Required for Windows.Forms Class Composition Designer support
>			///
>
>			InitializeComponent();
>			//
>			// TODO: Add any constructor code after InitializeComponent call
>			//
>		}
>
>		/// <summary>
>		/// Clean up any resources being used.
>		/// </summary>
>		protected override void Dispose( bool disposing )
>		{
>			if( disposing )
>			{
>				if(components != null)
>				{
>					components.Dispose();
>				}
>			}
>			base.Dispose( disposing );
>		}
>
>
>		#region Component 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.components = new System.ComponentModel.Container();
>			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(a4uButtonGetFolder));
>			this.ButtonImageList = new System.Windows.Forms.ImageList(this.components);
>			//
>			// ButtonImageList
>			//
>			this.ButtonImageList.ImageSize = new System.Drawing.Size(16, 16);
>			this.ButtonImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ButtonImageList.ImageStream")));
>			this.ButtonImageList.TransparentColor = System.Drawing.Color.Transparent;
>
>			//
>			// Button Properties
>			//
>			this.ImageIndex = 0;
>			this.ImageList = this.ButtonImageList;
>			this.Text = "";
>		}
>		#endregion
>	}
>}
>
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform