Пример #1
0
        /// <summary>
        ///     Handle DPI changes for the specified ContextMenuStrip
        /// </summary>
        /// <param name="contextMenuStrip">ContextMenuStrip</param>
        /// <returns>DpiHandler</returns>
        public static DpiHandler AttachDpiHandler(this ContextMenuStrip contextMenuStrip)
        {
            // Create a DpiHandler which runs "outside" of the contextMenu (not via WinProc)
            var dpiHandler = new DpiHandler(true);

            dpiHandler.MessageHandler = contextMenuStrip.WinProcFormsMessages().Subscribe(message => dpiHandler.HandleContextMenuMessages(message));
            return(dpiHandler);
        }