I'm looking to change a control's color in my report.RDLC. My reports are all generated by the ReportViewer control on a form called "rv".
The selected rectangle below is the one I'm looking to change colors.
It has the following properties:
How do I programmatically change the Background color of the rectangle?
I figured it out after a few hours. On the control of which you want to change background colors, select the "Expression" link from the dropdown.
Afterwards you enter in the code such as:
=iif(Fields!State.Value = "Approved", "LightYellow", iif(Fields!State.Value = "Analysis", "LightGreen", "Transparent"))
This will set the color of my textbox to light yellow if it's state is "Approved", or light green if it is in it's analysis stage. If none of those are true, it just stays transparent (default).
*Note: My "State" field was added in my dataset so I was able to use it in the expression.
Related
I am trying to set the color of an indicator to different colors based on different values, like 1 = red, 2 = blue etc. Using guidance from a Youtube video (accessible using this link: https://www.youtube.com/watch?v=czUmPQmKmGU), I have created a Colors[4] control for the indicator I have after changing it to the "write" function.
The Problem on the front panel is that I am getting a control with numbers instead of a color box where I can select the colors to show based on the value. This was the control I got instead.
This is the control I am trying to achieve (below):
Is there any way that I can get the color box on my control instead of the number controls? I am not sure if it can be changed through a control on the front panel or something but what I have tried so far keeps leading me back to this problem.
Any advice is much appreciated
A color box control is just a U32 number (three bytes for RGB and one which is always 0), which is why that's what you get.
There is a right click plugin which adds a replace with color box option directly to the right click menu of unsigned 32 bit numbers, but I don't remember if it ships with LV or not.
If you don't have that, you can always just right click the indicator inside the cluster, select replace and navigate the palettes to find the color box. You can also copy a color box and then select the indicator and paste, which replaces the selected control.
The color[4] is actually an array of 4 colors (UInt32 as Yair said), that define 2 color gradients, one for the 'Off' state, and the other for the 'On' State of the control.
If you want to set the control's color, you will have to define all 4 of them.
I am trying to create a column plot where each column has a different color. Plus I need to add ".data_labels" - so the values are visible.
Currently, I can change color of the font (in the data_labels). But I can't find how I can add "background color" to that label.
I want to make sure that black text will be on white background on top of the column (columns will have light and dark colors - so, it is not enough to change color of the font).
So, this will look like there is a white text box on top of column. Inside the box ("data_label") is text in black.
Note: I am using stacked graph, so I can't put text outside column (e.g. on top of the bar).
chart.add_series({ (...),
'data_labels': {'value' : True, 'position': 'inside_base',
'font': {'color': 'black', 'bg_color': 'white'}})
I am trying to make a red label appear on my form and can not. I have tried changing the property to RGB and HEX and just get errors. Is there a way to get a property value to make my label RGB(200, 0, 0)? I am unaware of how the value in the property areas is developed.
This is the only way I can make a red label:
Private Sub Label13_Click()
Label13.BackColor = RGB(200, 0, 0)
End Sub
I have to click the label to make it red. Is there a way to use code to make it red when the form starts? Or perhaps generate a value for the property? Thank you for your help in advance.
You can use the Initialize event for the form instead of putting the event on a Click event.
Here is an example with the form named UserForm. Use the dropdowns to select the form and then the Initialize event.
You can also just set the color in the properties if you know this is the color you want.
I'm trying to use a TableLayoutPanel to align a few controls on a form next to their labels like so:
Label1 [combobox ]
LongerLabel [longer combobox]
But when I run the project and grab the right hand side of the form and shrink the form, the combobox doesn't resize, it gets cut off... Now, I were to not use the TableLayoutPanel, but just anchor a combobox to a form's edges, it will resize properly. What am I doing wrong with the TableLayoutPanel?
I found the answer here:
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.windowsforms.controls/2006-12/msg00209.html
So I set the first column with the label to autosize (I have the label fill docked in the cell and the text alignment set to middle left). Then dock fill the combobox in the second column. Then, set the second column's size type to 100%, NOT autosize. I don't know why it works, but it does.
I've created some animated as well as static banners in Flash CS5 and I'd like to apply clickTag ActionScript 2.0 code to them. However, I only found tutorials where over all the existing layers, you create a rectangle using the Rectangle Primitive Tool, set the border, fill, and opacity to 0 and then apply the code and export the movie. When I create the rectangle, there is no setting for opacity, and when I set no border and no fill, the rectangle disappears and the dark dot in the timeline becomes empty so I can't click on the rectangle in order to convert it into a symbol.
I would really appreciate any advice on this!
Create your rectangle using 'Rectangle Primitive' tool shapes menu instead of the regular Rectangle tool.
select your rectangle by a single click.
From the properties panel select the bucket symbol (the one used to control the fill color) and you will find a setting 'alpha' for setting the transparency.
change the alpha value to 0. after that remove the stroke.
select your rectangle, from the top menu : Modify > Convert to symbol. give it a name and select 'button' from the dropdown. press ok.
now select the button you just created, open the actions panel and paste the following code :
on (release) {
if (clickTAG.substr(0, 5) == "http:")
{
getURL(clickTAG, "_blank");
}
}