Esempio n. 1
0
        public MainForm(Options startupOptions)
        {
            _startupOptions = startupOptions;

            FullscreenManager          = new FullscreenFormManager(this);
            _quickRegionDrawingHandler = new ThumbnailPanel.RegionDrawnHandler(HandleQuickRegionDrawn);

            //WinForms init pass
            InitializeComponent();

            //Store default values
            DefaultNonClickTransparencyKey = this.TransparencyKey;
            DefaultBorderStyle             = this.FormBorderStyle;

            //Thumbnail panel
            _thumbnailPanel = new ThumbnailPanel {
                Location = Point.Empty,
                Dock     = DockStyle.Fill
            };
            _thumbnailPanel.CloneClick += new EventHandler <CloneClickEventArgs>(Thumbnail_CloneClick);
            Controls.Add(_thumbnailPanel);

            //Set native renderer on context menus
            Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(
                menuContext, menuWindows, menuOpacity, menuResize, menuFullscreenContext
                );

            //Start timer
            InitializeTimer();

            //Set to Key event preview
            this.KeyPreview = true;

            Log.Write("Main form constructed");
        }
Esempio n. 2
0
        public MainForm(Options startupOptions)
        {
            _startupOptions = startupOptions;

            //WinForms init pass
            InitializeComponent();

            //Store default values
            DefaultNonClickTransparencyKey = this.TransparencyKey;
            DefaultBorderStyle = this.FormBorderStyle;

            //Thumbnail panel
            _thumbnailPanel = new ThumbnailPanel {
                Location = Point.Empty,
                Dock = DockStyle.Fill
            };

            _thumbnailPanel.CloneClick += new EventHandler<CloneClickEventArgs>(Thumbnail_CloneClick);
            Controls.Add(_thumbnailPanel);
            ShowInTaskbar = false;
            TopMost = false;

            //Set to Key event preview
            this.KeyPreview = true;
        }
Esempio n. 3
0
        public MainForm(Options startupOptions)
        {
            _startupOptions = startupOptions;

            //WinForms init pass
            InitializeComponent();

            //Store default values
            DefaultNonClickTransparencyKey = this.TransparencyKey;
            DefaultBorderStyle = this.FormBorderStyle;

            //Thumbnail panel
            _thumbnailPanel = new ThumbnailPanel {
                Location = Point.Empty,
                Dock = DockStyle.Fill
            };
            _thumbnailPanel.CloneClick += new EventHandler<CloneClickEventArgs>(Thumbnail_CloneClick);
            Controls.Add(_thumbnailPanel);

            //Set native renderer on context menus
            Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(
                menuContext, menuWindows, menuOpacity, menuResize, menuFullscreenContext
            );

            //Set to Key event preview
            this.KeyPreview = true;
        }
Esempio n. 4
0
        protected override void WndProc(ref Message m)
        {
            if (_msgPumpManager != null)
            {
                if (_msgPumpManager.PumpMessage(ref m))
                {
                    return;
                }
            }

            switch (m.Msg)
            {
            case WM.NCRBUTTONUP:
                //Open context menu if right button clicked on caption (i.e. all of the window area because of glass)
                if (m.WParam.ToInt32() == HT.CAPTION)
                {
                    OpenContextMenu(null);

                    m.Result = IntPtr.Zero;
                    return;
                }
                break;

            case WM.NCLBUTTONDOWN:
                if ((ModifierKeys & Keys.Control) == Keys.Control &&
                    ThumbnailPanel.IsShowingThumbnail &&
                    !ThumbnailPanel.DrawMouseRegions)
                {
                    ThumbnailPanel.EnableMouseRegionsDrawingWithMouseDown();
                    ThumbnailPanel.RegionDrawn += _quickRegionDrawingHandler;

                    m.Result = IntPtr.Zero;
                    return;
                }
                break;

            case WM.NCLBUTTONDBLCLK:
                //Toggle fullscreen mode if double click on caption (whole glass area)
                if (m.WParam.ToInt32() == HT.CAPTION)
                {
                    FullscreenManager.Toggle();

                    m.Result = IntPtr.Zero;
                    return;
                }
                break;

            case WM.NCHITTEST:
                //Make transparent to hit-testing if in click through mode
                if (ClickThroughEnabled)
                {
                    m.Result = (IntPtr)HT.TRANSPARENT;

                    RefreshClickThroughComeBack();
                    return;
                }
                break;
            }

            base.WndProc(ref m);
        }