Пример #1
0
        // スクリーンキャプチャ
        void ScreenCapture()
        {
            LayoutParameter target_parameter = GetTargetParameter();
            UIntPtr         window           = target_parameter.Window;

            if (!ExternalAPI.IsWindow(window))
            {
                return;
            }
            IntPtr window_dc = ExternalAPI.GetDC(window);

            if (window_dc == IntPtr.Zero)
            {
                // 不正なウィンドウなので何もしない
                return;
            }

            Graphics graphics           = Graphics.FromImage(captured_bitmap_);
            IntPtr   captured_bitmap_dc = graphics.GetHdc();

            // BitBlt
            ExternalAPI.BitBlt(captured_bitmap_dc, 0, 0, captured_bitmap_.Width, captured_bitmap_.Height,
                               window_dc, target_parameter.ClippingX, target_parameter.ClippingY, ExternalAPI.SRCCOPY);
            graphics.ReleaseHdc(captured_bitmap_dc);
            graphics.Dispose();

            ExternalAPI.ReleaseDC(window, window_dc);
        }
Пример #2
0
 public void SetPrimaryDesktopWindow()
 {
     ExternalAPI.RECT primary_desktop_rect;
     ExternalAPI.GetClientRect(ExternalAPI.GetDesktopWindow(), out primary_desktop_rect);
     this.SetWindowWithClippingRegion(ExternalAPI.GetDesktopWindow(),
                                      primary_desktop_rect.left, primary_desktop_rect.top,
                                      primary_desktop_rect.right, primary_desktop_rect.bottom);
 }
Пример #3
0
    public void ShowHighscore(string tableId)
    {
        if (!TryIsInitialized())
        {
            return;
        }

        ExternalAPI.ShowHighscore(tableId, ExternalAPI.JsCallback);
    }
        //-------------------------------------------------------------------

        void Apply()
        {
            // フォームのクライアント領域をスクリーン座標に変換
            Rectangle window_rect = RectangleToScreen(this.ClientRectangle);

            // デスクトップ取り込みに変更
            ((LayoutParameter)layout_parameters_.Current).SetWindowWithClippingRegion(
                ExternalAPI.GetDesktopWindow(),
                window_rect.X, window_rect.Y, window_rect.Width, window_rect.Height);
        }
Пример #5
0
    public void SaveHighscore(string tableId, int score)
    {
        if (!TryIsInitialized())
        {
            return;
        }
        if (!TryIsLoggedIn())
        {
            return;
        }

        ExternalAPI.SaveHighscore(tableId, score, ExternalAPI.JsCallback);
    }
Пример #6
0
        //===================================================================
        // イベントハンドラ
        //===================================================================

        private void target_MouseDown(object sender, MouseEventArgs e)
        {
            var mouse_down_control_location = e.Location;

            mode_ = GetModeFromMouseControlLocation(mouse_down_control_location);
            last_mouse_container_location_ = ControlToContainer(mouse_down_control_location);
            current_container_location_    = target_.Location;
            current_size_ = target_.Size;

            if (mode_ != Mode.kNop && mode_ != Mode.kMove)
            {
                ExternalAPI.ReleaseCapture();
                int hittest_result = GetHitTestResult(mode_);
                ExternalAPI.SendMessage(target_.Handle, ExternalAPI.WM_NCLBUTTONDOWN, new IntPtr(hittest_result), IntPtr.Zero);
            }
        }
Пример #7
0
        /// @brief 検証
        void Validate()
        {
            errors_.Clear();

            // もっとも危険な状態になりやすいウィンドウからチェック
            if (this.Window == UIntPtr.Zero || !ExternalAPI.IsWindow(this.Window))
            {
                errors_["Window"] = "Specified window is invalid";
            }

            // 境界設定のチェック
            if (this.BoundRelativeTop >= this.BoundRelativeBottom)
            {
                errors_["BoundRelativeTop"]    = "Specified bound-top is invalid";
                errors_["BoundRelativeBottom"] = "Specified bound-bottom is invalid";
            }
            if (this.BoundRelativeLeft >= this.BoundRelativeRight)
            {
                errors_["BoundRelativeLeft"]  = "Specified bound-left is invalid";
                errors_["BoundRelativeRight"] = "Specified bound-right is invalid";
            }

            // クリッピングリージョンの判定
            Rectangle bound_rectangle    = this.WindowRectangle;
            Rectangle clipping_rectangle = this.ClippingRectangle;

            if (this.ClippingWidth == 0)
            {
                errors_["ClippingWidth"] = "Clipping-width is invalid";
            }
            if (this.ClippingHeight == 0)
            {
                errors_["ClippingHeight"] = "Clipping-height is invalid";
            }
            if (!bound_rectangle.Contains(clipping_rectangle))
            {
                // bound_rectangleが(0,0,0,0)なら必ず実行される
                errors_["ClippingX"]      = "Clipping-x is invalid";
                errors_["ClippingY"]      = "Clipping-y is invalid";
                errors_["ClippingWidth"]  = "Clipping-width is invalid";
                errors_["ClippingHeight"] = "Clipping-height is invalid";
            }
        }
Пример #8
0
        //-------------------------------------------------------------------

        /// @brief コンストラクタ
        public MovableAndResizable(Control target, bool is_parent_exists)
        {
            // デスクトップ領域外へは行かないように
            if (is_parent_exists)
            {
                bounds_ = Rectangle.Empty;
            }
            else
            {
                bounds_ = scff_app.Utilities.GetWindowRectangle(ExternalAPI.GetDesktopWindow());
            }

            target_ = target;

            // イベントハンドラの登録
            target_.MouseDown   += target_MouseDown;
            target_.MouseMove   += target_MouseMove;
            target_.MouseUp     += target_MouseUp;
            target_.SizeChanged += target_SizeChanged;
        }
Пример #9
0
 public API(string appId)
 {
     ExternalAPI.Init(appId, ExternalAPI.JsCallback);
 }