i'm creating 64 button dynamically during run time. and from database i'm getting the description, font color, back color and picture path. and if the picture path is not nothing, then i need to display that picture in that button. if picture path is nothing, then need to display the description as button text using font color and back color.
this button values are not loaded only once. using button click Addhandler, each button values keeps on changing each time.
The Code i used to display is
Expand|Select|Wrap|Line Numbers
- For Each c As Control In Controls
- If c.Name = "ItemBtn-" & x Then
- c.Text = ButtonText
- c.ForeColor = System.Drawing.ColorTranslator.FromOle(btnFontColor)
- c.BackColor = System.Drawing.ColorTranslator.FromOle(btnBackColor)
- c.Tag = "ItemPageBtn-" & i
- c.Location = New System.Drawing.Point(gLeft, gTop)
- If btnPicture <> "" And btnPicture <> Nothing Then
- gButton.Image = Image.FromFile(btnPicture)
- End If
- c.Visible = True
- c.Visible = True
- Exit For
- End If
- Next
but the image is not fitting inside the Button. i can see only half of the image. i need a way to make the Image stretched or reduced to fit inside button.
is it possible??? if anyone have any idea how to do this, please help me. and if you can provide an example, then it will be great help for me.
Thanks in advance.