link button to an icon

  • Thread starter Thread starter Mr. X.
  • Start date Start date
M

Mr. X.

After linking button to an icon, by : button.image = ...
How can I decide what button size it should be ?

Thanks :)
 
Some problems, is that the icon is too small, and I want to stretch it, or
handle its size.
 
Am 05.03.2010 01:19, schrieb Mr. X.:
After linking button to an icon, by : button.image = ...
How can I decide what button size it should be ?

Which button type are you talking about?
 
The code is for VB on VS 2008.
....
dim b as Button
b = New Button()
b.Text = "test"

I didn't set any type, I suppose it is a default type.
As you said, it may be an interesting solution, I would like to know about.

Thanks :)
 
Am 05.03.2010 10:51, schrieb Mr. X.:
The code is for VB on VS 2008.
...
dim b as Button
b = New Button()
b.Text = "test"

I didn't set any type, I suppose it is a default type.
As you said, it may be an interesting solution, I would like to know about.

Sorry, Web Forms, Windows Forms, or something else? The reason I am
asking is that the Windows Forms 'Button' class does not have an 'Image'
property.
 
Am 05.03.2010 10:51, schrieb Mr. X.:



Sorry, Web Forms, Windows Forms, or something else?  The reason I am
asking is that the Windows Forms 'Button' class does not have an 'Image'
property.

Hi,

System.Windows.Forms.Button class has Image property, because
ButtonBase base class has it.
http://msdn.microsoft.com/en-us/library/system.windows.forms.buttonbase.image.aspx

As the question OP asking, he/her needs to re-size button as the same
as image's size like that:

' Assign image to Button1
Button1.Image = Image.FromFile("c:\image.jpg")
' Resize button based on image's size
Button1.Size = New Size(Image.FromFile("c:\image.jpg").Size)

Onur Güzel
 
Back
Top