Anyone have an idea how to get the background and line color from a custom hatch fill?
the following code fills the selected shape using data from textboxes
ActiveSelectionRange.ApplyCustomHatchFill ANG.value, LS.value, 0, 0, 0, LT.value, CreateRGBColor(255, 0, 0), BackColor:=CreateRGBColor(255, 255, 255)
this works fine I also have a color picker that changes the color of the line and background which is fine but if you change the line size the color changes back to what is specified in the code above
what I need to get is the current color of the line and backcolor in the selected shape so that I can change the line thickess while retaining the set color
i have a feeling its something to do with GET patternfill.backcolor but I cant find any examples on its usage
Any help is appreciated
mark
UPDATE
OK I have found the following gets the back colour into a string
value = s.Fill.Hatch.BackColor.ToString
I can then do a split and get the values
But there doesn't seem to be an option for getting the line colour (Forecolor)
Any Ideas?
Hatch Fill
A shape's hatch fill is a HatchFill object. It has one BackColor and one or multiple Patterns().
Each pattern has an Outline (specifying the line in the pattern) which has a Color which can be read by e. g. ToString or other methods to read a color.
If you want to change other properties of your hatch fill lines, please see all the properties and methods of an Outline here
Some examples:
s.Fill.Hatch.BackColor ' background color
s.Fill.Hatch.Patterns(1).Outline.Color ' line color of first pattern
s.Fill.Hatch.Patterns(1).Outline.Width ' line width of first pattern
You may also check, if it really has an opaque background: Fill.Hatch.HasBackground
Pattern Fill
Just in case: A pattern fill is simpler and has only two colors:
s.Fill.Pattern.FrontColor
s.Fill.Pattern.BackColor
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 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.
I am loading a dataset into my report and filling my last column with this expression: =Sum(Fields!ID.Value) and it loads fine, I am trying to put a condition in so when the number is less than 15 for example, the cell color will change to red. I have tried so many different syntax but nothing works... it must be pretty simple...?
The errors I am getting are: The value expression for textbox has scope parameter that is invalid for aggregate
Any help would be good :)
To set the background color Click on the cell and in properties window on your right hand select the BackgroundColor property and then set expression to that property.
Or right click on cell and select TextboxProperties -> Fill and at the start there is option to set the expression for fill color.
You are using the wrong expression the expression should be ,
= IIF(Sum(Fields!ID.Value) < 15,"Red","Transparent")
You can change the Transparent to whatever color you want.Take a look here on how to use expressions.
This shows how you could add a colour range if necessary by using the Color property to set the font colour.
=iif(Sum(Fields!ID.Value) < 15,"Red",iif(Sum(Fields!ID.Value)>50,"Blue","Black"))
To Change the background colour instead you would use the Background colour property.
=iif(Sum(Fields!ID.Value) < 15,"Red", "No Color")
Note that SSRS 2008 "Transaparent" is replaced by "No Color". Whilst transaparent works it gives rise to this warning message.
[rsInvalidColor] The value of the BackgroundColor property for the textbox ‘textbox22’ is “Transparent”, which is not a valid BackgroundColor.
As an alternative to these use "#FFFFFF" instead of Transaparent or No Color
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.
I have a custom coloured background that the user can choose, this however means when they change the colour, the label is invisible because it is the same as the background and I do not want this. The code I have is: opacityLabel.textColor = bgView.backgroundColor; In this bit of code the colour is the same at the start but doesn't change when I adjust the background colour, I also need the colour to continually change with the background colour, I was wondering what I could replace with "=" to make the label do the opposite colour. I can't do "!=" because that means is not equal to rather than opposite! If you can't do it this way could you provide me with a way of doing it?
The first thing you'll need to do is calculate the opposite colour to the backgroundColor, and then assign it to the textColor property.
To do this you'll need to use the getRed:green:blue:alpha: method on backgroundColor. This will give you values between 0.0 and 1.0 for each component of your colour.
Then use the UIColor class method colorWithRed:green:blue:alpha: to create a new UIColor, but use (1.0 - component value) for each of the components.
Then finally assign your new colour to opacityLabel.textColor