예제 #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 = Rhino.Runtime.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);
            }
예제 #2
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;
      }