Ejemplo n.º 1
0
            private static int OnCustomColorDialog(ref int argb, int colorButtons, IntPtr titleAsStringHolder, IntPtr hParent)
            {
                int rc = 0;

                if (m_ShowCustomColorDialog != null)
                {
                    try
                    {
                        var color = System.Drawing.Color.FromArgb(argb);
                        System.Windows.Forms.IWin32Window parent = null;
                        string            title = StringHolder.GetString(titleAsStringHolder);
                        GetColorEventArgs e     = new GetColorEventArgs(color, colorButtons == 1, title);

                        if (hParent != IntPtr.Zero)
                        {
                            parent = new RhinoWindow(hParent);
                        }
                        m_ShowCustomColorDialog(parent, e);
                        if (e.SelectedColor != System.Drawing.Color.Empty)
                        {
                            argb = e.SelectedColor.ToArgb();
                            rc   = 1;
                        }
                    }
                    catch (Exception ex)
                    {
                        Runtime.HostUtils.ExceptionReport(ex);
                    }
                }
                return(rc);
            }