Exemplo n.º 1
0
        private void RenderDialog(DialogResourceData d)
        {
#if NativeDialogs
            RenderDialogNative(d);
#else
            _form = new MenuDialogHelperForm();
            _form.LoadDialog(d.Dialog);

            _form.Show(this);
#endif

            /////////////////////

            __itemsTree.BeginUpdate();
            __itemsTree.Nodes.Clear();

            var root = new TreeNode("Dialog - \"" + d.Dialog.Text + "\"");
            __itemsTree.Nodes.Add(root);

            foreach (var c in d.Dialog.Controls)
            {
                var n = new TreeNode(c.ToString());
                root.Nodes.Add(n);
            }

            root.ExpandAll();

            __itemsTree.EndUpdate();
        }
Exemplo n.º 2
0
        private void RenderDialogNative(Object o)
        {
            DialogResourceData d = o as DialogResourceData;

            IntPtr p = Marshal.AllocHGlobal(d.RawData.Length);

            Marshal.Copy(d.RawData, 0, p, d.RawData.Length);

            NativeMethods.DialogProc proc = new NativeMethods.DialogProc(DialogProc);
            _dialogProcs.Add(proc);

            IntPtr hInstance = Marshal.GetHINSTANCE(typeof(MenuDialogHelperForm).Module);

            IntPtr hWndDialog = NativeMethods.CreateDialogIndirectParam(hInstance, p, this.Handle, proc, IntPtr.Zero);

            Marshal.FreeHGlobal(p);
        }