I am using the System.Drawing tools to create a graphic. The graphic has a lot of text labels in it.
I create the font:
var font = new Font("Verdana", 10);
and then, for each label, make the text bold, or not using this:
font = new Font(font, FontStyle.Bold);
font = new Font(font, FontStyle.Regular);
I want to store all the text for the labels in a database along with font size and whether it is to be bold or not.
Say I return a list of values from a database like, for example:
10, bold
12, regular
10, bold,
14, bold
10, regular
and put those values in a list object with properties of myfontSize and myfontStyle and loop through the list … what is the best way to modify my System.Drawing font to reflect the changes in Font Size and Font Weight required in each iteration?
You haven’t really provided enough information to answer this question fully. However, without going into much detail in terms of how you get the list, if you have a list of font sizes/style then you would just iterate the collection and create a new font object e.g.