Change only Font Family via FontDialogBox - vb.net

I'm developing a Windows Form App in VB and I want to create a menu where the user can modify FontStyle and ForeColor of some Labels. This Labels have specific Size according to the GUI.
The idea is to permit the user to change the appearance of the GUI (personalize the font) to be for example more readble. Because of this I need to preserve the ratio between small labels and big labels also in a not absolute precise way (pic)
I'm already using a FontDialog that returns me Color and Font but applying it (obv) change also the size of the font.
This is a portion of my code now:
For Each formLabel As Label In formLabels
formLabel.ForeColor = FontDialog1.Color
formLabel.Font = FontDialog1.Font
Next formLabel
It's possible to change only the FontFamily of a Label (by code)?

Related

Can font size and style be dynamically changed at the same time?

I'm trying to create a form that allows the user to edit text on another form, however only the size OR style (bold, italic etc.) of the font is changed instead of both.
My current code:
fnt = Form1.Label6.Font
Form1.Label6.Font = New Font(fnt.Name, 12)
Putting FontStyle.Bold after means that size will only be bold. This is the same for regular and italic. I have a feeling I'm overlooking something simple but i just can't figure it out.
Thank you

Changing Label's Image According To Variable?

I'm trying to make (using Visual Basic) a rudimentary questionnaire that measures multiple attributes and stores their values in an array and afterwards measures the attributes on a scale of 1 to 10.Now I've had the dumb idea to use a label for every single value of every attribute, and highlighting the right number by changing the label's image to yellow, instead of white(basically making the area behind the number a different color).
Now here's the issue: I can't seem to find out how to change a label's background image with code, which is what I'm asking. (I'm guessing the command should look something like "Label1.image = >image path<")
Pretty simple.
If text = No then
Label.Text = No
Else
Label.Text = Yes
End IF
You just have to change the text value of the label which is .Text = Text you want
And if your trying to show images, you should use the image control in the tool box, not a label

Setting/manipulating color and line color for SimpleFillSymbol

I am trying to create a graphics layer over a designated area that has a background color and an opposing line color. I read on the API Documentation that the color parameter only applies when SimpleFillSymbol.style = "STYLE_SOLID". Is there a way to set a color when SimpleFillSymbol.style = "STYLE_FORWARD_DIAGONAL"?
So with my current need I need the background to be yellow with lines running through it.
restricted_areas.symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_FORWARD_DIAGONAL, null, new Color([255, 255, 0]));
I simply get a background with lines but no color. Is there a way around this?
You can't set the color because the fill for SimpleFillSymbol.STYLE_FORWARD_DIAGONAL is an image
If you're using the Arcgis JSAPI from arcgis.com then the image is located here.
http://js.arcgis.com/3.15/esri/images/symbol/sfs/forwarddiagonal.png?version=4
So using SimpleFillSymbol with the STYLE_FORWARD_DIAGONAL style is really just a convenience function for a PictureFillSymbol with a specific picture.
To change and customize the color of the fill you'll have to use a PictureFillSymbol and then you can use whatever image and color you want.

Resizing a dynamically created label to fit the text inside it?

I'm creating a label dynamically, and then adding text to it dynamically (and the amount of text added to it will be different each time). So, the label needs to always be the same width as the text inside it.
This happens by default when creating a label in the Windows Designer. But when creating a label dynamically, it appears to be "set" at a specific width, regardless of how much text is in it (which means that it often "cuts off" some of the text).
So... any idea how I can get the dynamically created label to always stay the same width as the text inside it?
If you want to do it manually, you can do something like this, every time you change the text:
Dim g As Graphics = Label1.CreateGraphics()
Label1.Width = CInt(g.MeasureString(Label1.Text, Label1.Font).Width)
However, it's much easier to simply set the label's AutoSize property to True and let the label do the work for you.
Label1.AutoSize = True

Checkboxes in Rdlc Report

I am creating rdlc report and i have issue that i got some bool type object fields and now i have to show checkboxes. but there is nothing i found for this solution to show checkboxes in table.
Is there anyone who know that how i can implement that thing?
Maybe you can put image there, depend on true or false, just display different pic. LOL
If checkbox is true I set Chr(254) else show unchecked checkbox using Chr(168).
Chr(254): This is decimal value for Wingdings character 254 its shows like checked check box image.
Chr(168): This is decimal value for Wingdings character 168 its shows like rectangle box like unchecked check box image.
I had a requirement that the checkboxes have a background color. I liked the simplicity of a text-based rather than image-based approach, so I used a variation of the popular Wingdings-font method: I used a small, square textbox with a thin border and the specified background color, set it to use a bold, sans-serif font, and used this expression for the text value:
=IIf(Fields!SomeBool.Value, "X", "")
If you still want a checkmark rather than an X, you can use Wingdings 2 font and this expression:
=IIf(Fields!SomeBool.Value, Chr(80), "")
In either case, you may have to adjust the font size and/or box size to keep the result square; my first take was taller than wide because it expanded vertically to accommodate the font.
Or you can set the textbox placeholder to render tags as html and then put this html in: Or you can set the Placeholder expression to support HTML and then set up the following html code:
<font face="Wingdings 2" color="green">#Html.Raw(((char)0x51).ToString())</font>
You should put in the character of the wingdings that you want.
This way, only part of the text can be wingdings.
Wingdings 2
Finally I got solution
here is the link download the project and run it.
http://uploading.com/files/2mmf34m8/Nestle%2BNew.rar/
i have developed class and then used list to set bool variable true/false. while on other hand i used image control in rdlc report To set image.
You just need to set image path which are already in image folder.
Cheers.