Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI elements with Eto #2545

Open
WileyNg opened this issue Aug 26, 2023 · 0 comments
Open

GUI elements with Eto #2545

WileyNg opened this issue Aug 26, 2023 · 0 comments

Comments

@WileyNg
Copy link

WileyNg commented Aug 26, 2023

Hi @cwensley

I have initiated a discussion in the forum here:
https://discourse.mcneel.com/t/custom-ui-elements-with-eto-forms/162955/21

Is there any possibility of receiving support for the Eto GUI elements?

Currently, we are employing a workaround to use a transparent Eto.Form by utilizing a WPF hack with styling, as shown below:

            Eto.Style.Add<Eto.Forms.Panel>(
            "transparent-form", control =>
            {
                var wpfwnd = (System.Windows.Window)control.ControlObject;
                wpfwnd.AllowsTransparency = true;

                wpfwnd.Background = swm.Brushes.Transparent;
                wpfwnd.Topmost = true;
                wpfwnd.ShowActivated = false;
                wpfwnd.WindowStyle = sw.WindowStyle.None;
            });

image
Since it's currently not possible to create a moduless form that can be attached to the viewport window at the moment, we are employing a convoluted way to hook the form to the viewport window.

        [DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
//hWndChild is created by the NativeHandle Property from each Control
//hWndNewParent is the active viewport window, found using the NativeHandle of the Rhino Application:
        [DllImport("user32")]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool EnumChildWindows(IntPtr window, EnumedWindow callback, ArrayList lParam);

Is there a better way to accomplish this? The current method lacks stability since the functionality is not integrated into the Eto library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant