예제 #1
0
            /// <returns>0 Cancel, 1 OK, 2 Retry.</returns>
            public int Show(Bitmap img, ICFlags flags, RECT r)
            {
                _img    = img;
                _flags  = flags;
                _cursor = MouseCursor.Load(ResourceUtil.GetBytes("<Au>resources/red_cross_cursor.cur"), 32);
                _dpi    = screen.primary.Dpi;
                _w      = WndUtil.CreateWindow(_WndProc, true, "#32770", "Au.uiimage.CaptureUI", WS.POPUP | WS.VISIBLE, WSE.TOOLWINDOW | WSE.TOPMOST, r.left, r.top, r.Width, r.Height);
                _w.ActivateL();

                try {
                    while (Api.GetMessage(out var m) > 0 && m.message != Api.WM_APP)
                    {
                        switch (m.message)
                        {
                        case Api.WM_KEYDOWN when !_capturing:
                            switch ((KKey)(int)m.wParam)
                            {
                            case KKey.Escape: return(0);

                            case KKey.F3: return(2);
                            }
                            break;

                        case Api.WM_RBUTTONUP when m.hwnd == _w:
                            switch (popupMenu.showSimple("1 Retry\tF3|2 Cancel\tEsc", owner: _w))
                            {
                            case 1: return(2);

                            case 2: return(0);
                            }
                            break;
                        }
                        Api.DispatchMessage(m);
                    }
                }
                finally {
                    var w = _w; _w = default;
                    Api.DestroyWindow(w);
                }
                return(_res);
            }