예제 #1
0
        public void ScrollView(int dx, int dy, bool update) {

            // スクロール開始通知
	        cur_.on_scroll_begin();

	        //Rectangle clip = (dy==0 ? cvs_.zone() : new Rectangle() /*NULL*/);
            Win32API.RECT clip = (dy == 0 ? cvs_.zone() : new Win32API.RECT());
            bool isClipeNull = dy != 0;

	        int H = cvs_.getPainter().H();

	        // スクロールバー更新
	        if( dx != 0 ){
		        // 範囲チェック
		        if( hScrollBar.Value+dx < 0 )
			        dx = -hScrollBar.Value;
		        else if( hScrollBar.Maximum-hScrollBar.nPage < hScrollBar.Value+dx ) 
			        dx = hScrollBar.Maximum-hScrollBar.nPage-hScrollBar.Value+1;

		        //hScrollBar.Value += dx;
		        //::SetScrollInfo( hwnd_, SB_HORZ, &rlScr_, TRUE );
		        //dx = -dx;
                hScrollBar.Value += dx;
                dx = -dx;
	        }
	        if( dy != 0 ){
		        // 範囲チェック…は前処理で終わってる。
		        //vScrollBar.Value += dy;
		        //::SetScrollInfo( hwnd_, SB_VERT, &udScr_, TRUE );
		        //dy *= -H;
                vScrollBar.Value += dy;
                dy *= -H;
	        }

	        if( dx!=0 || dy!=0 ){
		        if( -dx>=right() || dx>=right()
		         || -dy>=bottom() || dy>=bottom() ){
			        // 全画面再描画
			        // ちょうど65536の倍数くらいスクロールしたときに、
			        // ScrollWindowEx on Win9x だと再描画が変なのを回避。
			        //::InvalidateRect( hwnd_, NULL, FALSE );
                    this.Invalidate(false);
		        }else{
			        // 再描画の不要な領域をスクロール
			        //::ScrollWindowEx( hwnd_, dx, dy, NULL, 
					//        clip, NULL, NULL, SW_INVALIDATE );

                    if (isClipeNull) {
                        Win32API.ScrollWindow(this.Handle, dx, dy);
                    }
                    else {
                        Win32API.ScrollWindow(this.Handle, dx, dy, clip);
                    }

			        // 即時再描画?
			        if( update ){
				        // 縦スクロールは高速化したいので一工夫
                        if (dy != 0) {
                            if (DrawEventHandler == null) {
                                //// 再描画の必要な領域を自分で計算
                                //RECT rc = {0,0,right(),bottom()};
                                //if( dy < 0 ) rc.top  = rc.bottom + dy;
                                //else         rc.bottom = dy;

                                //// インテリマウスの中ボタンクリックによる
                                //// オートスクロール用カーソルの下の部分を先に描く
                                //// 2回に分けることで、小さな矩形部分二つで済むので高速
                                //::ValidateRect( hwnd_, &rc );
                                //::UpdateWindow( hwnd_ );
                                //::InvalidateRect( hwnd_, &rc, FALSE );

                                Win32API.RECT rc = new Win32API.RECT();
                                rc.left = 0; rc.top = 0; rc.right = right(); rc.bottom = bottom();
                                if (dy < 0) rc.top = rc.bottom + dy;
                                else rc.bottom = dy;

                                Win32API.ValidateRect(this.Handle, ref rc);
                                //this.Update();
                                Win32API.UpdateWindow(this.Handle);
                                Win32API.InvalidateRect(this.Handle, ref rc, false);
                            }
                        }
                        //else {
                        //    Win32API.UpdateWindow(this.Handle);
                        //}
                        //this.Update(); //TODO scroll                        
			        }
		        }
	        }

	        // スクロール終了通知
	        cur_.on_scroll_end();
        }
예제 #2
0
 internal void SetClip(Win32API.RECT rc)
 {
     Win32API.IntersectClipRect(dc_, rc.left, rc.top, rc.right, rc.bottom);
 }
예제 #3
0
 public void ClearClip()
 {
     Win32API.SelectClipRgn(dc_, IntPtr.Zero);
 }
예제 #4
0
 public void Invert(Graphics g, Rectangle rect)
 {
     Win32API.InvertRect(g.GetHdc(), ref rect);
     g.ReleaseHdc();
 }