Help Updating Eto.Drawable Graphics - Cross-Class Communication

I’ve done some testing and as you say, when the View size is changed it will fire 2+ events.
If I resize a view I get two, if I create a new floating viewport I get quite a few event fires.

My guess is no. It’s likely that on our end the Viewport is modified twice when the size is changed.

Is the double event fire causing you an issue?

I’m listening to this event to pin an Eto-based HUD element to a fixed position in the viewport. To avoid multiple redraws, I added a check to execute my logic only when the screenrectangle is different to the previous one.

I’m fine with this workaround but wanted to let you know about the underlying issue.

2 Likes

Ah gotcha, yes that’s reasonable. I appreciate you raising this.

@dale can you provide further insight? If it’s something we should fix I’ll create a YouTrack :slight_smile:

1 Like

I’m doing the same in Python and also noticed the multiple event firing for what it’s worth.

Separately but related, it seems that a full screen toggle does not constitute a ViewModified event?

Do you all see that behavior as well?

If entering full screen, all the Eto.Forms Forms seem to shift downward slightly and then return to their correct position when toggling back to not full screen.

I read somewhere that full screen is different on Mac vs Windows because of what both OSs constitute as a “window” or “view” or whatever.

Still trying to pin it down

Eto.Forms Form connection Location to the rhino ActiveView

test

 ToolMenu = new ToolsBar();//Eto.Forms.Form
                    ToolMenu.Show();

                    Eto.Forms.Screen primaryScreen = Eto.Forms.Screen.PrimaryScreen;
                    float Rscale = primaryScreen.RealScale;
                    float scale = primaryScreen.Scale;
                    float coff = Rscale / scale;

                    System.Drawing.Rectangle rect = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ScreenRectangle;
                    System.Drawing.Point location = rect.Location;
                    // int rectW = rect.Width;
                    // int rectH = rect.Height;
                    // int ToolW = ToolMenu.Width;
                    // int ToolH = ToolMenu.Height;

                    var point =  new Eto.Drawing.PointF(location.X/ coff, location.Y / coff);
                    ToolMenu.Location = new Eto.Drawing.Point(point);

I don’t know if this method is universal, protest if you can.

Hey @taraskydon,

While that would work in simple cases (single monitor), it’ll fall apart in multi-monitor situations.

Instead, try using var myEtoPoint = Rhino.UI.EtoExtensions.ToEtoScreen(mySDPoint);

Edit: For those that need it, the reciprocal method is ToSystemDrawingScreen() to go the other way.

Hope this helps!

2 Likes

this ToEtoDrawingScreen in Rhino 8 ?

Yes, it’s in v8.7.24095.14001 or later.

Rhino.UI.EtoExtensions.ToEtoScreen I think you mean this method.

2 Likes

:man_facepalming:yes, you are right. I was typing from memory so I got confused with the reciprocal method ToSystemDrawingScreen.

1 Like