예제 #1
0
 public void TestUnpackParamsAreTheSameAsOriginal()
 {
     var packager = new CoordsPackager();
     var param = new RECT { Left = 1, Top = 2, Right = 3, Bottom = 4 };
     var packedParams = packager.PackParams(param);
     var result = packager.UnpackParams(packedParams.LParam, packedParams.WParam);
     Assert.AreEqual(param, result);
 }
예제 #2
0
 public RECT UnpackParams(IntPtr lParam, IntPtr wParam)
 {
     var p1 = (uint)wParam;
     var p2 = (uint)lParam;
     var result = new RECT
         {
             Left = (int) (p1 >> BitsToShift),
             Top = (int) (p1 & BitMask),
             Right = (int) (p2 >> BitsToShift),
             Bottom = (int) (p2 & BitMask)
         };
     return result;
 }
예제 #3
0
        public MessageParams PackParams(RECT rect)
        {
            // C++ would unpack it like this:
            //const unsigned int p1 = (unsigned int)wParam;
            //const unsigned int p2 = (unsigned int)lParam;
            //buttonsRect.left = p1 >> 16;
            //buttonsRect.top = p1 & 0xFFFF;
            //buttonsRect.right = p2 >> 16;
            //buttonsRect.bottom = p2 & 0xFFFF;
            var result = new MessageParams
                {
                    WParam = (IntPtr) ((((uint) rect.Left) << BitsToShift) | (((uint) rect.Top) & BitMask)),
                    LParam = (IntPtr) ((((uint) rect.Right) << BitsToShift) | (((uint) rect.Bottom) & BitMask))
                };

            return result;
        }
예제 #4
0
 public void TestWidthIsCalculatedCorrectly()
 {
     var rect = new RECT() { Left = 1, Right = 10 };
     Assert.AreEqual(9, rect.Width);
 }
예제 #5
0
 public void TestSettingWidthSetsRightCorrectly()
 {
     var rect = new RECT() { Left = 1, Right = 10 };
     rect.Width = 5;
     Assert.AreEqual(6, rect.Right);
 }
예제 #6
0
 public void TestSettingHeightSetsBottomCorrectly()
 {
     var rect = new RECT() { Top = 1, Bottom = 10 };
     rect.Height = 5;
     Assert.AreEqual(6, rect.Bottom);
 }
예제 #7
0
 public void TestHeightIsCalculatedCorrectly()
 {
     var rect = new RECT() { Top = 1, Bottom = 10 };
     Assert.AreEqual(9, rect.Height);
 }
예제 #8
0
파일: Interop.cs 프로젝트: artgo/CefSharp
 public static extern uint SendMessage(IntPtr hWnd, int Msg, int wParam, ref RECT lParam);
예제 #9
0
파일: Interop.cs 프로젝트: artgo/CefSharp
 public static extern bool IntersectRect(out RECT lprcDst, [In] ref RECT lprcSrc1, [In] ref RECT lprcSrc2);
예제 #10
0
파일: Interop.cs 프로젝트: artgo/CefSharp
 public RECT(RECT rect)
 {
     Left = rect.Left;
     Top = rect.Top;
     Right = rect.Right;
     Bottom = rect.Bottom;
 }