ETO.DRAWING.COLOR in the conduit is system.drawing.color acceptable to use?

Hi All,

I am converting existing code to ETO forms, and running into a snag in my conduit code when attempting to assign an ETO based color.

e.Display.DrawCurve(ConduitCurve, Eto.Drawing.Color.FromArgb(120, 75, 190), 255):wink:

(or any incantation of an eto color)

Results in an error, cannot convert eto.color to system.drawing.color.


I assume to be eto compliant i need to use the ETO color? or will system.drawing.color work as well and still be compliant on mac systems?

I dont own a MAC to test on at the moment?

You need to use System.Drawing.Color indeed, since that is what the DrawCurve function takes.

ok, but, that will work on Apples?

The method and its parameters are the same between the platforms. It should work on MacOS as well.

1 Like



question if i may, ETO tripping me up again.

in winforms, I can create an array or list of buttons, and assign a click event to them in a for-loop, and simply pass the control index as a parameter, and it works great, but in ETO the sender is ALWAYS the last index number of the loop.(+1) in this case

example pseudocode (the winforms version very similar)

//setup a new List<Button> buttonlist
//setup a new List<ImageView> images

for(int i=0;i<6){
    buttonlist.Add(new Button {Text = "Click to Add", Size = ConstructionSizeControls });
    buttonlist[i].Click += (sender, e) => AddPart(i);
    images.Add(new ImageView());

but, the sender index passed in this case is ALWAYS 6, irrespective of the button clicked.

AddPart(int index) {
    images[index].Image = someimagecaptureroutine();
    setobjectcolor = Dropdown[i].selectedindex;
    /* etc etc */

Any thoughts on how this owrks in ETO? The controls in each “division” are all interelated and index each other in my winforms code so dropdown[i] == button[i] == image[i] etc. and the number of parts can vary by user simply adding more so they must live in the list and be indexable by the list.

Note that you’re not passing in sender to AddPart, but i.

I’d adapt AddPart so that you actually pass in the sender. Before you set the event handler for Click I’d add a Tag to the Button instance. Set it to your i. In your AddPart you’d use the Tag - since it’ll be object you’ll have to cast it back to int.


I use Tag in one place where I have a bunch of controls all using the same event handler:

Note checking of the sender type and then casting of the Tag.

I set Tags starting here

Many thanks!

that might be the most casting I have ever done ina single line of code, but, it works :wink:

public void AddPart(object sender) {
PictureBoxes[(int)((Button)sender).Tag].Image = Classes.ImageHandler.GetImageFromViewPort().ToEto();

for future reference reasons for other viewers of the thread, I compiled some code using the windows colours in the conduit instead fo the ETO colours and they worked fine.