I am trying to set the background color of a layer.
I have tried:
PreView.currentlayer.FillColor := BWColorPicker.SelectedColor; //nothing changes PreView.Background := BWColorPicker.SelectedColor; //This works for the base background color
I would like to change the default layer from white to a user select color as the fill color.
procedure TBWCSBF.BWColorPickerChange(Sender: TObject); begin PreView.currentlayer.FillColor := BWColorPicker.SelectedColor; //Nothing happens with this PreView.FillTool.ColorFillValue := BWColorPicker.SelectedColor;// This works when using the bucket fill tool PreView.Background := BWColorPicker.SelectedColor; //This works for the background PreView.Update();//I used this before as well without the '()' and it didn't work. end;
I have tried it with this as well and still not working, however the bucket fill works as expected. I tried this with a blank project with only a color button and ImageEnView component with the code firing on the button's on change event and the results are the same.
One last thing, this is the default layer[0] created by ImageEnView at startup. I have also tried adding layers and the result with the layer background color is the same, it doesn't change.
Okay, so it turns out I had to use PreView.Proc.fill(BWColorPicker.SelectedColor); as this is a flood fill.
So it adds to the question as to why I need to do it this way as apposed to picking a layer to fill the background? And why the other way doesn't work?
Sorry, I misunderstood your usage. If the layer is an image, then you need to edit it using image methods. The color properties of layers only apply to vector layers.
FillColor is just a shortcut method to the actual properties of the relevant layer types, it has no effect for TIEImageLayers. Please see the details at: