Setting/manipulating color and line color for SimpleFillSymbol - arcgis

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.

Related

Change only Font Family via FontDialogBox

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)?

CorelDraw VBA Hatchfill color

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

VB.NET MENUSTRIP doesnt honor ImageScaling at runtime

I am trying to implement a 'Flag' w/ a menustrip.
I have an image list w/ a red flag and a black flag.
When I click the menu item, i want to toggle the image.
The problem I have is that once I change the image, it wants to do SizeToFit which makes the Icon roughly the height of text. I dont want that. I want the Image to be its actual size.
I have tried putting the statements in different orders, nothing i have tried seems to work.
Currently, I have the button set to the black flag at design time.
This code shows me trying to change to a Red flag.
tsbFlagPatient.Image = ilFlags.Images(1)
tsbFlagPatient.ImageScaling = ToolStripItemImageScaling.None
tsbFlagPatient.DisplayStyle = ToolStripItemDisplayStyle.Image
[If there is some better way to approach toggling the image, im open to that. That seems like a separate question. ]
I was unable to make ImageScrolling work.
Since I dont need text here, I used BackGround Image and set
BackgroundImageLayout = Stretch
This allows the images to be the right size.
You can turn AutoSize = false and then manually set Height, Width to fine tune your menu's size.
I did reconsider the ImageList and changed the images to being stored in the project Resources. This is the code to toggle the image
Public Sub SetFlagImage(flagSet As Boolean)
If flagSet = False Then
btnFlag.BackgroundImage = My.Resources.appbar_flag_wavy_black
btnFlag.BackgroundImage.Tag = "black"
Else
btnFlag.BackgroundImage = My.Resources.appbar_flag_wavy_red
btnFlag.BackgroundImage.Tag = "red"
End If
End Sub
This had no effect on the question posed here. In general, probably better than having an image list because all forms can access it.

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

How to obtain opposite colour

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