コード例 #1
0
        // Retrieves a new object from a Form object
        static public SystemMenu CreateFromForm(Form f)
        {
            SystemMenu menu = new SystemMenu();

            menu.SysMenu = win32GetSystemMenu(f.Handle, 0);
            if (menu.SysMenu == IntPtr.Zero)
            {
                throw new NoSystemMenuException();
            }

            return(menu);
        }
コード例 #2
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                SystemMenu sysMenu = SystemMenu.CreateFromForm(this);
                sysMenu.InsertSeparator(0);
                sysMenu.InsertMenu(0, AboutID, "About this tool...");
            }
            catch (NoSystemMenuException)
            {
            }

            generateButton_Click(null, null);
        }