rafaelrgl
asked on
draw string in a bitmap
hi, i have this code:
objBmpImage = New Bitmap(objBmpImage, New Size(960, 832))
objGraphics = Graphics.FromImage(objBmpI mage)
objGraphics.SmoothingMode = SmoothingMode.AntiAlias
objGraphics.TextRenderingH int = TextRenderingHint.AntiAlia s
objGraphics.DrawString(vte xt, New Font("Arial", 35, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Pixel), Brushes.White, 30, 25)
how can i draw this string inside my working area of the bitmap, so if the string is small, then the size will be bigger to fill the space, if the string is bigger then the size it will be small. and how to justify the text.
objBmpImage = New Bitmap(objBmpImage, New Size(960, 832))
objGraphics = Graphics.FromImage(objBmpI
objGraphics.SmoothingMode = SmoothingMode.AntiAlias
objGraphics.TextRenderingH
objGraphics.DrawString(vte
how can i draw this string inside my working area of the bitmap, so if the string is small, then the size will be bigger to fill the space, if the string is bigger then the size it will be small. and how to justify the text.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
emoreau,
this is not what i want, because i am doing inside an rectangleF, and not just one line so the thext goes inside a box, and i want to scale the font to fit this box, so, if i have long text, the font will be set smaller to fit the area i am printing the text, if the text is short the font will be bigger so it will fit this area.
this is not what i want, because i am doing inside an rectangleF, and not just one line so the thext goes inside a box, and i want to scale the font to fit this box, so, if i have long text, the font will be set smaller to fit the area i am printing the text, if the text is short the font will be bigger so it will fit this area.
Is the text supposed to wrap?...or does it have distinct lines that must stay on those lines and you want to maximize how those lines fit in the box?
ASKER
it's suppose to wrap
ASKER
and be justify
ASKER
i´m sorry but i put the wrong line for the string, the right one is this one:
objGraphics.DrawString(vte
because the one i put before it~s just for one line, and i want to fit not only on the line but the text goes all the way to the end of the image, so i have an rectangleF, i need to scale to fit on this rectangle.
any help