R
RSH
Hi,
I am building a Win Forms application that I would like to feed a function a
collection of strings (button text) that the program will go through and
generate and save the generated buttons.
The issue Im having is that I cant find any tutorials on how to do the
following:
I have three graphics the Right End Cap the center (which I want to tile to
fit the text) and the left end cap. I want to generate the text calculate
the width of the text, tile the center section and center the button text
then put the left and right end cap graphics on either side and save the
graphic.
So far this is what I came up with (simple text on graphic then saving it):
Sub createButtons()
Dim imgPath As String = "\DynamicButtonMaker\DynamicButtonMaker\"
Dim bmp As Bitmap = New Bitmap(imgPath & "Middle.jpg")
Dim e As Graphics = Graphics.FromImage(bmp)
e.TextRenderingHint = Text.TextRenderingHint.AntiAlias
e.DrawString("Test Button", New Font("Verdana", 24, FontStyle.Bold), New
SolidBrush(Color.White), 0, 0)
bmp.Save(imgPath & "TestButton.jpg")
End Sub
Thanks for any help you might be able to provide.
Ron
I am building a Win Forms application that I would like to feed a function a
collection of strings (button text) that the program will go through and
generate and save the generated buttons.
The issue Im having is that I cant find any tutorials on how to do the
following:
I have three graphics the Right End Cap the center (which I want to tile to
fit the text) and the left end cap. I want to generate the text calculate
the width of the text, tile the center section and center the button text
then put the left and right end cap graphics on either side and save the
graphic.
So far this is what I came up with (simple text on graphic then saving it):
Sub createButtons()
Dim imgPath As String = "\DynamicButtonMaker\DynamicButtonMaker\"
Dim bmp As Bitmap = New Bitmap(imgPath & "Middle.jpg")
Dim e As Graphics = Graphics.FromImage(bmp)
e.TextRenderingHint = Text.TextRenderingHint.AntiAlias
e.DrawString("Test Button", New Font("Verdana", 24, FontStyle.Bold), New
SolidBrush(Color.White), 0, 0)
bmp.Save(imgPath & "TestButton.jpg")
End Sub
Thanks for any help you might be able to provide.
Ron