コード例 #1
0
 internal Dialog(DlgTemplate template) : this()
 {
     Size        = new Size(template.cx, template.cy);
     Location    = new Point(template.x, template.y);
     Text        = template.exTitle;
     WindowClass = template.exWindowClass;
 }
コード例 #2
0
ファイル: CustomOpenFile.cs プロジェクト: stuart2w/SAW
            /// <summary>
            /// Builds an in-memory Win32 dialog template.  See documentation for DLGTEMPLATE.
            /// </summary>
            /// <returns>a pointer to an unmanaged memory buffer containing the dialog template</returns>
            private IntPtr BuildDialogTemplate()
            {
                // We must place this child window inside the standard FileOpenDialog in order to get any
                // notifications sent to our hook procedure.  Also, this child window must contain at least
                // one control.  We make no direct use of the child window, or its control.

                // Set up the contents of the DLGTEMPLATE
                DlgTemplate template = new DlgTemplate();

                // Allocate some unmanaged memory for the template structure, and copy it in
                IntPtr ipTemplate = Marshal.AllocCoTaskMem(Marshal.SizeOf(template));

                Marshal.StructureToPtr(template, ipTemplate, true);
                return(ipTemplate);
            }
コード例 #3
0
        private static Dialog Build(BinaryReader rdr)
        {
            var header = new DlgTemplate(rdr);

            var ctrls = new List <DlgItemTemplate>();

            rdr.Align4();

            for (var i = 0; i < header.cdit; i++)
            {
                var ctrl = new DlgItemTemplate(rdr);
                ctrls.Add(ctrl);

                rdr.Align4();
            }

            var ret = new Dialog(header);

            foreach (var itemT in ctrls)
            {
                ret.Controls.Add(new DialogControl(itemT));
            }
            return(ret);
        }