コード例 #1
0
        void _timer_Tick(object sender, object e)
        {
            ControlToWatch[] snapshot = _controlsToWatch.ToArray();
            foreach (ControlToWatch controlToWatch in snapshot)
            {
                //get the element's new Position:
                Point            elementCurrentPosition = INTERNAL_PopupsManager.GetUIElementAbsolutePosition(controlToWatch.ControltoWatch);
                Size             elementCurrentSize;
                FrameworkElement control = controlToWatch.ControltoWatch as FrameworkElement;
                if (control != null)
                {
                    elementCurrentSize = control.INTERNAL_GetActualWidthAndHeightUsinggetboudingClientRect();
                }
                else
                {
                    elementCurrentSize = new Size();
                }

                if (elementCurrentPosition != controlToWatch.PreviousPosition ||
                    !INTERNAL_SizeComparisonHelpers.AreSizesEqual(elementCurrentSize, controlToWatch.PreviousSize))
                {
                    controlToWatch.OnPositionOrSizeChanged(elementCurrentPosition, elementCurrentSize);
                    controlToWatch.PreviousPosition = elementCurrentPosition;
                    controlToWatch.PreviousSize     = elementCurrentSize;
                }
            }
        }
コード例 #2
0
        void _timer_Tick(object sender, object e)
        {
            foreach (ControlToWatch controlToWatch in _controlsToWatch)
            {
                //get the element's new Position:
                Point elementCurrentPosition = INTERNAL_PopupsManager.GetUIElementAbsolutePosition(controlToWatch.ControltoWatch);
                Size  elementCurrentSize;
                if (controlToWatch.ControltoWatch is FrameworkElement)
                {
                    elementCurrentSize = ((FrameworkElement)controlToWatch.ControltoWatch).INTERNAL_GetActualWidthAndHeight();
                }
                else
                {
                    elementCurrentSize = new Size();
                }

                if (elementCurrentPosition != controlToWatch.PreviousPosition || !INTERNAL_SizeComparisonHelpers.AreSizesEqual(elementCurrentSize, controlToWatch.PreviousSize))
                {
                    controlToWatch.OnPositionOrSizeChanged(elementCurrentPosition, elementCurrentSize);
                    controlToWatch.PreviousPosition = elementCurrentPosition;
                    controlToWatch.PreviousSize     = elementCurrentSize;
                }
            }
        }