alain bertrand Member Licensed User Longtime User Nov 30, 2019 #1 A label color is defined as Default in the designer. The code turns it into (e.g.) Label.TextColor = Colors.red. How to bring the color back to Default by code without selecting any other color? Thanks in advance.
A label color is defined as Default in the designer. The code turns it into (e.g.) Label.TextColor = Colors.red. How to bring the color back to Default by code without selecting any other color? Thanks in advance.
M Mahares Expert Licensed User Longtime User Nov 30, 2019 #2 alain bertrand said: How to bring the color back to Default by code without selecting any other color? Click to expand... Code: Copy lbl1.Tag=lbl1.Background 'initially set to default , stored color in tag lbl1.Color=Colors.Red 'then later play around with colors lbl1.Background=lbl1.Tag 'when you want to go back to default setting issue this code Upvote 0
alain bertrand said: How to bring the color back to Default by code without selecting any other color? Click to expand... Code: Copy lbl1.Tag=lbl1.Background 'initially set to default , stored color in tag lbl1.Color=Colors.Red 'then later play around with colors lbl1.Background=lbl1.Tag 'when you want to go back to default setting issue this code
M Mahares Expert Licensed User Longtime User Nov 30, 2019 #3 Maybe something like this if you are dealing with the label text colors instead of the label color: Code: Copy lbl1.Text="You are ready" lbl1.Tag=lbl1.TextColor lbl1.TextColor=Colors.Magenta lbl1.textColor=lbl1.Tag Upvote 0
Maybe something like this if you are dealing with the label text colors instead of the label color: Code: Copy lbl1.Text="You are ready" lbl1.Tag=lbl1.TextColor lbl1.TextColor=Colors.Magenta lbl1.textColor=lbl1.Tag
Cableguy Expert Licensed User Longtime User Nov 30, 2019 #4 Mahares said: Maybe something like this if you are dealing with the label text colors instead of the label color: Code: Copy lbl1.Text="You are ready" lbl1.Tag=lbl1.TextColor lbl1.TextColor=Colors.Magenta lbl1.textColor=lbl1.Tag Click to expand... In addition, the tag property can be used to store an array, a list or even a map, so you can use it to store any "default" values you want Upvote 0
Mahares said: Maybe something like this if you are dealing with the label text colors instead of the label color: Code: Copy lbl1.Text="You are ready" lbl1.Tag=lbl1.TextColor lbl1.TextColor=Colors.Magenta lbl1.textColor=lbl1.Tag Click to expand... In addition, the tag property can be used to store an array, a list or even a map, so you can use it to store any "default" values you want
alain bertrand Member Licensed User Longtime User Dec 1, 2019 #5 It's working. Thank you, good idea to use the tag of the object. Upvote 0