Exemplo n.º 1
0
        /// <summary>
        /// WM_PAINT消息处理
        /// </summary>
        /// <param name="window">可双缓冲渲染的控件(客户区)</param>
        /// <param name="m">消息</param>
        /// <param name="e">如果该值为null,则自动创建默认PaintEventArgs.否则将直接使用该值作为OnPaint的参数</param>
        public static void WmPaint(IUIWindow window, ref Message m, PaintEventArgs e)
        {
            //========Begin
            IntPtr hWnd = m.HWnd;

            NativeMethods.PAINTSTRUCT ps = new NativeMethods.PAINTSTRUCT();
            IntPtr hDC = UnsafeNativeMethods.BeginPaint(hWnd, ref ps);

            //========Drawing
            try
            {
                if (e == null)
                {
                    using (Graphics g = Graphics.FromHdcInternal(hDC))
                    {
                        using (e = new PaintEventArgs(g, Rectangle.FromLTRB(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom)))
                        {
                            OnPaint(window, e);
                        }
                    }
                }
                else
                {
                    OnPaint(window, e);
                }
            }
            finally
            {
                //========End
                UnsafeNativeMethods.EndPaint(hWnd, ref ps);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查找所在的 Win32 控件
        /// </summary>
        /// <returns>所在的 Win32 控件</returns>
        public IUIWindow FindUIWindow()
        {
            IUIControl parent = this;
            IUIWindow  window = null;

            while (parent != null && (window = parent as IUIWindow) == null)
            {
                parent = parent.UIParent;
            }
            return(window);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 将控件坐标系的点转换为所在 Win32 控件坐标系的点
        /// </summary>
        /// <param name="p">点</param>
        /// <returns>转换后的点</returns>
        public Point PointToUIWindow(Point p)
        {
            IUIControl parent = this;
            IUIWindow  window = null;

            while (parent != null && (window = parent as IUIWindow) == null)
            {
                p.Offset(parent.Left, parent.Top);
                parent = parent.UIParent;
            }
            return(p);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 将控件坐标系的矩形转换为所在 Win32 控件坐标系的矩形
        /// </summary>
        /// <param name="r">矩形</param>
        /// <returns>转换后的矩形</returns>
        public Rectangle RectangleToUIWindow(Rectangle r)
        {
            IUIControl parent = this;
            IUIWindow  window = null;

            while (parent != null && (window = parent as IUIWindow) == null)
            {
                r.Offset(parent.Left, parent.Top);
                parent = parent.UIParent;
            }
            return(r);
        }
Exemplo n.º 5
0
        public static void GoBack()
        {
            int windows_count = callStack.Count;

            if (windows_count > 0)
            {
                IUIWindow currentWindow = callStack[windows_count - 1];
                currentWindow.Close();
                callStack.RemoveAt(windows_count - 1);
            }
            else
            {
                Minimize();
            }
        }
Exemplo n.º 6
0
        private void HideAllWindowsExceptTarget(MainScreenStatesEnum state)
        {
            IUIWindow targetWindow = _dictionaryStates[state];



            for (int i = 0; i < _windows.Count; i++)
            {
                IUIWindow tempWindow = _windows[i];

                if (tempWindow != targetWindow)
                {
                    tempWindow.Hide();
                }
            }
        }
 /// <summary>
 /// 重绘所在 Win32 窗口的无效区域,可以选择是否强制刷新
 /// </summary>
 /// <param name="forceUpdate">强制刷新为 true,否则为false</param>
 protected void UpdateCore(bool forceUpdate)
 {
     if (forceUpdate || !this.UpdateSuspended)
     {
         IUIControl parent = this;
         IUIWindow  window = null;
         while (parent != null && (window = parent as IUIWindow) == null)
         {
             parent = parent.UIParent;
         }
         if (window == null)
         {
             return;
         }
         window.Update();
     }
 }
Exemplo n.º 8
0
        // INTERFACES

        public void SwitchState(MainScreenStatesEnum state)
        {
            Core.Instance.UnMute();
            if (_currentState == state)
            {
                return;
            }

            IUIWindow targetWindow = _dictionaryStates[state];

            HideAllWindowsExceptTarget(state);

            targetWindow.Show();

            _currentState = state;
            Debug.Log("_currentState  " + _currentState.ToString());
        }
 /// <summary>
 /// 使控件矩形无效,可以选择是否强制刷新
 /// </summary>
 /// <param name="rc">无效矩形</param>
 /// <param name="invalidateChildren">使控件所在的 Win32 窗口的子控件无效为 true,否则为 false</param>
 /// <param name="forceUpdate">强制刷新为 true,否则为false</param>
 protected void InvalidateCore(Rectangle rc, bool invalidateChildren, bool forceUpdate)
 {
     if (forceUpdate || !this.UpdateSuspended)
     {
         IUIControl parent = this;
         IUIWindow  window = null;
         while (parent != null && (window = parent as IUIWindow) == null)
         {
             rc.Offset(parent.Left, parent.Top);
             parent = parent.UIParent;
         }
         if (window == null)
         {
             return;
         }
         window.Invalidate(rc, invalidateChildren);
     }
 }
 /// <summary>
 /// 立即刷新所在 Win32 窗口和其子控件,可以选择是否强制刷新
 /// </summary>
 /// <param name="forceUpdate">强制刷新为 true,否则为false</param>
 protected void RefreshCore(bool forceUpdate)
 {
     if (forceUpdate || !this.UpdateSuspended)
     {
         IUIControl parent = this;
         IUIWindow  window = null;
         Rectangle  rc     = this.ClientRectangle;
         while (parent != null && (window = parent as IUIWindow) == null)
         {
             rc.Offset(parent.Left, parent.Top);
             parent = parent.UIParent;
         }
         if (window == null)
         {
             return;
         }
         window.Invalidate(rc, true);
         window.Update();
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// 先在缓冲区渲染再复制到目标设备(客户区)
        /// </summary>
        /// <param name="window">可双缓冲渲染的控件</param>
        /// <param name="e">原始渲染数据数据或称作目标设备渲染数据</param>
        public static void OnPaint(IUIWindow window, PaintEventArgs e)
        {
            //缓冲区准备
            if (!window.DoubleBufferedGraphics.Prepare())
            {
                return;
            }

            //使用缓冲区绘图
            Rectangle clip = e.ClipRectangle;

            using (PaintEventArgs b = new PaintEventArgs(window.DoubleBufferedGraphics.Graphics, window.ClientRectangle))
            {
                window.DoubleBufferedGraphics.Graphics.SetClip(clip, CombineMode.Replace);
                window.RenderCore(b);
            }

            //使用缓冲区渲染目标设备
            e.Graphics.SetClip(clip, CombineMode.Replace);
            window.DoubleBufferedGraphics.Render(e);
        }
Exemplo n.º 12
0
        private void OnRender(UIContainer container, IUIWindow window)
        {
            if (container.UIObjects == null)
            {
                return;
            }
            for (int j = 0; j < container.UIObjects.Length; j++)
            {
                var uiObject = container.UIObjects[j];
                if (uiObject.Callback != null)
                {
                    var newValue = window.Draw(
                        j,
                        true,
                        uiObject.Value,
                        uiObject.Text
                        );

                    if (uiObject.Value == null)
                    {
                        try
                        {
                            uiObject.Callback(newValue);
                        }
                        catch (Exception e)
                        {
                            ErrorOnce(
                                j + ": " + container.Key,
                                "Callback for {0}-{1} (null) failed:\n{2}",
                                container.Title,
                                j,
                                e
                                );
                        }
                    }
                    ///Hahaha, this is ugly and can easily break, but whatever
                    else if (newValue.GetHashCode() != uiObject.Value.GetHashCode())
                    {
                        try
                        {
                            uiObject.Callback(newValue);
                        }
                        catch (Exception e)
                        {
                            ErrorOnce(
                                j + ": " + container.Key,
                                "Callback for {0}-{1} ({2}=>{3}) failed:\n{3}",
                                container.Title,
                                j,
                                uiObject.Value.GetType(),
                                newValue.GetType(),
                                e
                                );
                        }
                        uiObject.Value = newValue;
                    }
                }
                else
                {
                    window.Draw(
                        j,
                        false,
                        uiObject.Value,
                        uiObject.Text
                        );
                }
                if (uiObject.NewLine)
                {
                    window.NewLine();
                }
                container.UIObjects[j] = uiObject;
            }
        }
Exemplo n.º 13
0
 public void Add(IUIWindow window)
 {
     this.windows.Add(window);
 }
Exemplo n.º 14
0
        public MainForm()
        {
            InitializeComponent();

            init();

            #region 加载上方按钮
            uiLeft.Init(0, 10);
            uiTop.Init(0, 10);
            uiRect.SetPosition(uiLeft, uiTop);
            uiWidth.Init(0, 32);
            uiHeight.Init(0, 32);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIWindowManager manager    = this.axRenderControl1.UIWindowManager;
            IUIWindow        rootWindow = manager.UIRootWindow;
            IUIImageButton   button1    = manager.CreateImageButton();
            button1.SetArea(uiRect);
            button1.Name        = "漫游";
            button1.IsVisible   = true;
            button1.NormalImage = (strMediaPath + @"\png\button\漫游\normal.png");
            button1.HoverImage  = (strMediaPath + @"\png\button\漫游\hover.png");
            button1.PushedImage = (strMediaPath + @"\png\button\漫游\pushed.png");
            rootWindow.AddChild(button1);
            button1.SubscribeEvent(gviUIEventType.gviUIMouseClick);
            this.axRenderControl1.RcUIWindowEvent += AxRenderControl1_RcUIWindowEvent;

            uiLeft.Init(0, 52);
            uiTop.Init(0, 10);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button2 = manager.CreateImageButton();
            button2.SetArea(uiRect);
            button2.Name        = "点选";
            button2.IsVisible   = true;
            button2.NormalImage = (strMediaPath + @"\png\button\点选\normal.png");
            button2.HoverImage  = (strMediaPath + @"\png\button\点选\hover.png");
            button2.PushedImage = (strMediaPath + @"\png\button\点选\pushed.png");
            rootWindow.AddChild(button2);
            button2.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0, 94);
            uiTop.Init(0, 10);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button3 = manager.CreateImageButton();
            button3.SetArea(uiRect);
            button3.Name        = "天气";
            button3.IsVisible   = true;
            button3.NormalImage = (strMediaPath + @"\png\button\天气\normal.png");
            button3.HoverImage  = (strMediaPath + @"\png\button\天气\hover.png");
            button3.PushedImage = (strMediaPath + @"\png\button\天气\pushed.png");
            rootWindow.AddChild(button3);
            button3.SubscribeEvent(gviUIEventType.gviUIMouseEntersArea);
            //button3.SubscribeEvent(gviUIEventType.gviUIMouseLeavesArea);

            uiLeft.Init(0, 94);
            uiTop.Init(0, 52);
            uiRect.SetPosition(uiLeft, uiTop);
            uiWidth.Init(0, 80);
            uiHeight.Init(0, 31);
            uiRect.SetSize(uiWidth, uiHeight);
            imgbtn1 = manager.CreateImageButton();
            imgbtn1.SetArea(uiRect);
            imgbtn1.Name        = "SunShine";
            imgbtn1.Text        = "晴天";
            imgbtn1.IsVisible   = false;
            imgbtn1.NormalImage = (strMediaPath + @"\png\button\晴天\normal.png");
            imgbtn1.PushedImage = (strMediaPath + @"\png\button\晴天\pushed.png");
            imgbtn1.HoverImage  = (strMediaPath + @"\png\button\晴天\hover.png");
            rootWindow.AddChild(imgbtn1);
            imgbtn1.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0, 94);
            uiTop.Init(0, 83);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            imgbtn2 = manager.CreateImageButton();
            imgbtn2.SetArea(uiRect);
            imgbtn2.Name        = "HeavyRain";
            imgbtn2.Text        = "大雨";
            imgbtn2.IsVisible   = false;
            imgbtn2.NormalImage = (strMediaPath + @"\png\button\大雨\normal.png");
            imgbtn2.PushedImage = (strMediaPath + @"\png\button\大雨\pushed.png");
            imgbtn2.HoverImage  = (strMediaPath + @"\png\button\大雨\hover.png");
            rootWindow.AddChild(imgbtn2);
            imgbtn2.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0, 94);
            uiTop.Init(0, 114);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            imgbtn3 = manager.CreateImageButton();
            imgbtn3.SetArea(uiRect);
            imgbtn3.Name        = "HeavySnow";
            imgbtn3.Text        = "大雪";
            imgbtn3.IsVisible   = false;
            imgbtn3.NormalImage = (strMediaPath + @"\png\button\大雪\normal.png");
            imgbtn3.PushedImage = (strMediaPath + @"\png\button\大雪\pushed.png");
            imgbtn3.HoverImage  = (strMediaPath + @"\png\button\大雪\hover.png");
            rootWindow.AddChild(imgbtn3);
            imgbtn3.SubscribeEvent(gviUIEventType.gviUIMouseClick);
            #endregion

            #region 加载下方按钮
            uiLeft.Init(0, 0);
            uiTop.Init(0.8f, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            uiWidth.Init(0.2f, 0);
            uiHeight.Init(0.2f, 0);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button4 = manager.CreateImageButton();
            button4.SetArea(uiRect);
            button4.Name        = "location1";
            button4.Text        = "location1";
            button4.IsVisible   = true;
            button4.NormalImage = (strMediaPath + @"\png\location\普通\2c495ffc-4641-447b-a5a4-636e4f3e7976.png");
            button4.PushedImage = (strMediaPath + @"\png\location\按下\2c495ffc-4641-447b-a5a4-636e4f3e7976.png");
            button4.HoverImage  = (strMediaPath + @"\png\location\选中\2c495ffc-4641-447b-a5a4-636e4f3e7976.png");
            rootWindow.AddChild(button4);
            button4.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0.2f, 0);
            uiTop.Init(0.8f, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button5 = manager.CreateImageButton();
            button5.SetArea(uiRect);
            button5.Name        = "location2";
            button5.Text        = "location2";
            button5.IsVisible   = true;
            button5.NormalImage = (strMediaPath + @"\png\location\普通\2e0ca5d1-73d2-4c28-9698-2b64c89cc806.png");
            button5.PushedImage = (strMediaPath + @"\png\location\按下\2e0ca5d1-73d2-4c28-9698-2b64c89cc806.png");
            button5.HoverImage  = (strMediaPath + @"\png\location\选中\2e0ca5d1-73d2-4c28-9698-2b64c89cc806.png");
            rootWindow.AddChild(button5);
            button5.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0.4f, 0);
            uiTop.Init(0.8f, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button6 = manager.CreateImageButton();
            button6.SetArea(uiRect);
            button6.Name        = "location3";
            button6.Text        = "location3";
            button6.IsVisible   = true;
            button6.NormalImage = (strMediaPath + @"\png\location\普通\76ba8729-0131-40f4-9713-9a9374a76936.png");
            button6.PushedImage = (strMediaPath + @"\png\location\按下\76ba8729-0131-40f4-9713-9a9374a76936.png");
            button6.HoverImage  = (strMediaPath + @"\png\location\选中\76ba8729-0131-40f4-9713-9a9374a76936.png");
            rootWindow.AddChild(button6);
            button6.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0.6f, 0);
            uiTop.Init(0.8f, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button7 = manager.CreateImageButton();
            button7.SetArea(uiRect);
            button7.Name        = "location4";
            button7.Text        = "location4";
            button7.IsVisible   = true;
            button7.NormalImage = (strMediaPath + @"\png\location\普通\84e489db-3f82-43fa-b068-c85f95f680f1.png");
            button7.PushedImage = (strMediaPath + @"\png\location\按下\84e489db-3f82-43fa-b068-c85f95f680f1.png");
            button7.HoverImage  = (strMediaPath + @"\png\location\选中\84e489db-3f82-43fa-b068-c85f95f680f1.png");
            rootWindow.AddChild(button7);
            button7.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            uiLeft.Init(0.8f, 0);
            uiTop.Init(0.8f, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            uiRect.SetSize(uiWidth, uiHeight);
            IUIImageButton button9 = manager.CreateImageButton();
            button9.SetArea(uiRect);
            button9.Name        = "location5";
            button9.Text        = "location5";
            button9.IsVisible   = true;
            button9.NormalImage = (strMediaPath + @"\png\location\普通\ffd10c67-373d-45d7-b901-b493ffc2741b.png");
            button9.PushedImage = (strMediaPath + @"\png\location\按下\ffd10c67-373d-45d7-b901-b493ffc2741b.png");
            button9.HoverImage  = (strMediaPath + @"\png\location\选中\ffd10c67-373d-45d7-b901-b493ffc2741b.png");
            rootWindow.AddChild(button9);
            button9.SubscribeEvent(gviUIEventType.gviUIMouseClick);

            #endregion


            IOverlayUILabel uilabel1 = this.axRenderControl1.ObjectManager.CreateOverlayUILabel(rootId);
            uiLeft.Init(0.5f, 0);
            uiTop.Init(0.5f, 0);
            uilabel1.SetAnchor(uiLeft, uiTop);
            IPoint pos1 = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ) as IPoint;
            pos1.SetCoords(15195.99, 35807.57, 16.76, 0, 0);
            uilabel1.WorldPosition      = pos1;
            uilabel1.MaxViewHeight      = -100; //垂直高度的可见范围
            uilabel1.MinViewHeight      = 50;
            uilabel1.MaxVisibleDistance = 300;  //直线距离的可见范围
            uilabel1.MinVisibleDistance = 0;
            IUIWindow wLabel1 = uilabel1.GetCanvas();
            //uiWidth.Init(1, 0);  //三维窗口宽
            //uiHeight.Init(1, 0);  ////三维窗口高
            uiWidth.Init(0, 200);
            uiHeight.Init(0, 100);
            uiRect.SetSize(uiWidth, uiHeight);
            wLabel1.SetArea(uiRect);  //设置画布宽高

            IUIStaticImage staticImg1 = manager.CreateStaticImage();
            string         img1       = manager.CreateImageFromFile(@"D:\TestData\png\CH4.png");
            staticImg1.SetImage(img1);
            uiLeft.Init(0, 0);
            uiTop.Init(0, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            uiWidth.Init(1, 0);
            uiHeight.Init(1, 0);
            uiRect.SetSize(uiWidth, uiHeight);
            staticImg1.SetArea(uiRect);
            staticImg1.IsMousePassThroughEnabled = true;  //响应鼠标事件
            //staticImg1.IsZOrderingEnabled = false;   //鼠标点击后不会跑上面来
            wLabel1.AddChild(staticImg1);

            IUIStaticLabel staticLab1 = manager.CreateStaticLabel();
            string         font1      = manager.CreateUIFont(15f, "aa");
            staticLab1.Text = "[font='" + font1 + "'][colour='FF0000FF']30/立方米";
            //staticLab1.Text = "30/立方米";
            uiLeft.Init(0.5f, 0);
            uiTop.Init(0.5f, 0);
            uiRect.SetPosition(uiLeft, uiTop);
            float textWid    = 0.0f;
            float textHeight = 0.0f;
            staticLab1.GetTextSize(out textWid, out textHeight);
            uiWidth.Init(0, textWid);
            uiHeight.Init(0, textHeight);
            uiRect.SetSize(uiWidth, uiHeight);
            staticLab1.SetArea(uiRect);
            wLabel1.AddChild(staticLab1);


            {
                this.helpProvider1.SetShowHelp(this.axRenderControl1, true);
                this.helpProvider1.SetHelpString(this.axRenderControl1, "");
                this.helpProvider1.HelpNamespace = "UIImageButton.html";
            }
        }
Exemplo n.º 15
0
 public GameLoopController(IControllerFactory controllerFactory, IUIWindow endGameView, IAudioPlayer audioPlayer) : base(controllerFactory)
 {
     _endGameView = endGameView;
     _audioPlayer = audioPlayer;
 }
Exemplo n.º 16
0
        public void TestCore(FormBorderStyle border, IUIWindow target)
        {
            //初始化
            this.FormBorderStyle = border;
            this.btnOut.UIParent = target;

            //FindUIWindow
            Assert.AreEqual(btnOut.FindUIWindow(), target);
            Assert.AreEqual(btnInner.FindUIWindow(), target);
            Assert.AreEqual(target.FindUIWindow(), target);

            //FindUIChild
            Assert.AreEqual(target.FindUIChild(Point.Empty), null);
            Assert.AreEqual(target.FindUIChild(new Point(10, 20)), this.btnOut);
            Assert.AreEqual(target.FindUIChild(new Point(109, 69)), this.btnOut);
            Assert.AreEqual(target.FindUIChild(new Point(15, 35)), this.btnInner);
            Assert.AreEqual(target.FindUIChild(new Point(64, 54)), this.btnInner);
            //FindUIChild
            Assert.AreEqual(this.btnOut.FindUIChild(Point.Empty), null);
            Assert.AreEqual(this.btnOut.FindUIChild(new Point(5, 15)), this.btnInner);
            Assert.AreEqual(this.btnOut.FindUIChild(new Point(54, 34)), this.btnInner);
            //FindUIChild
            Assert.AreEqual(target.FindUIChild("in2"), this.btnInner2);
            //PointToClient
            Point p  = new Point(15, 35);//window client
            Point sp = target.PointToScreen(p);

            Assert.AreEqual(target.PointToClient(sp), p);
            Assert.AreEqual(this.btnOut.PointToClient(sp), new Point(5, 15));
            Assert.AreEqual(this.btnInner.PointToClient(sp), Point.Empty);
            //PointToScreen
            Assert.AreEqual(target.PointToScreen(p), sp);
            Assert.AreEqual(this.btnOut.PointToScreen(new Point(5, 15)), sp);
            Assert.AreEqual(this.btnInner.PointToScreen(Point.Empty), sp);
            //PointToUIControl
            Assert.AreEqual(target.PointToUIControl(p), p);
            Assert.AreEqual(this.btnOut.PointToUIControl(p), new Point(5, 15));
            Assert.AreEqual(this.btnInner.PointToUIControl(p), Point.Empty);
            //PointToUIWindow
            Assert.AreEqual(target.PointToUIWindow(p), p);
            Assert.AreEqual(this.btnOut.PointToUIWindow(new Point(5, 15)), p);
            Assert.AreEqual(this.btnInner.PointToUIWindow(Point.Empty), p);
            //RectangleToClient
            Rectangle r  = new Rectangle(15, 35, 10, 20);//window client
            Rectangle sr = target.RectangleToScreen(r);

            Assert.AreEqual(target.RectangleToClient(sr), r);
            Assert.AreEqual(this.btnOut.RectangleToClient(sr), new Rectangle(5, 15, 10, 20));
            Assert.AreEqual(this.btnInner.RectangleToClient(sr), new Rectangle(0, 0, 10, 20));
            //RectangleToScreen
            Assert.AreEqual(target.RectangleToScreen(r), sr);
            Assert.AreEqual(this.btnOut.RectangleToScreen(new Rectangle(5, 15, 10, 20)), sr);
            Assert.AreEqual(this.btnInner.RectangleToScreen(new Rectangle(0, 0, 10, 20)), sr);
            //RectangleToUIControl
            Assert.AreEqual(target.RectangleToUIControl(r), r);
            Assert.AreEqual(this.btnOut.RectangleToUIControl(r), new Rectangle(5, 15, 10, 20));
            Assert.AreEqual(this.btnInner.RectangleToUIControl(r), new Rectangle(0, 0, 10, 20));
            //RectangleToUIWindow
            Assert.AreEqual(target.RectangleToUIWindow(r), r);
            Assert.AreEqual(this.btnOut.RectangleToUIWindow(new Rectangle(5, 15, 10, 20)), r);
            Assert.AreEqual(this.btnInner.RectangleToUIWindow(new Rectangle(0, 0, 10, 20)), r);
            //
            this.btnOut.SendToBack();
            this.btnOut.BringToFront();
        }
Exemplo n.º 17
0
 public static void AddWindow(IUIWindow window)
 {
     callStack.Add(window);
 }
Exemplo n.º 18
0
 /// <summary>
 /// WM_PAINT消息处理
 /// </summary>
 /// <param name="window">可双缓冲渲染的控件(客户区)</param>
 /// <param name="m">消息</param>
 public static void WmPaint(IUIWindow window, ref Message m)
 {
     WmPaint(window, ref m, null);
 }