protected virtual Point GetMappedWindowPoint(Point screenPoint)
 {
     Telerik.WinControls.NativeMethods.POINT pt = new Telerik.WinControls.NativeMethods.POINT();
     pt.x = screenPoint.X;
     pt.y = screenPoint.Y;
     if (this.Form.IsHandleCreated)
     {
         Telerik.WinControls.NativeMethods.MapWindowPoints(new HandleRef((object)this, IntPtr.Zero), new HandleRef((object)this, this.Form.Handle), pt, 1);
     }
     return(new Point(pt.x + this.ClientMargin.Left, pt.y + this.ClientMargin.Top));
 }
Exemple #2
0
        protected virtual void ShowCore(Point point, int ownerOffset, RadDirection popupDirection)
        {
            if (this.Visible || this.IsDisposed)
            {
                return;
            }
            if (this.LastShowDpiScaleFactor.IsEmpty)
            {
                this.LastShowDpiScaleFactor = new SizeF(1f, 1f);
            }
            if (this.LastShowDpiScaleFactor != this.dpiScaleFactor)
            {
                this.Scale(new SizeF(this.dpiScaleFactor.Width / this.LastShowDpiScaleFactor.Width, this.dpiScaleFactor.Height / this.LastShowDpiScaleFactor.Height));
                this.LastShowDpiScaleFactor = this.dpiScaleFactor;
            }
            this.showing = true;
            bool isLoaded = this.IsLoaded;

            this.SetTheme();
            if (!isLoaded)
            {
                this.LoadElementTree();
                isLoaded = this.IsLoaded;
            }
            this.SetTheme();
            Point empty = Point.Empty;
            Point location;

            if (this.ownerElement != null && this.ownerElement.IsDesignMode)
            {
                IntPtr activeWindow = Telerik.WinControls.NativeMethods.GetActiveWindow();
                Telerik.WinControls.NativeMethods.POINT pt = new Telerik.WinControls.NativeMethods.POINT(0, 0);
                Telerik.WinControls.NativeMethods.ClientToScreen(new HandleRef((object)this, activeWindow), pt);
                point.X -= pt.x;
                point.Y -= pt.y;
                location = !this.ownerElement.IsInValidState(true) ? this.OnDropDownLocationNeeded(point) : this.ownerElement.ElementTree.Control.PointToScreen(this.ownerElement.ControlBoundingRectangle.Location);
            }
            else
            {
                location = this.ownerElement == null?this.OnDropDownLocationNeeded(point) : (!this.ownerElement.IsInValidState(true) ? this.OnDropDownLocationNeeded(point) : this.ownerElement.ElementTree.Control.PointToScreen(this.ownerElement.ControlBoundingRectangle.Location));
            }
            location.Offset(ownerOffset, ownerOffset);
            Size      size = this.ownerElement != null ? this.ownerElement.ControlBoundingRectangle.Size : Size.Empty;
            Rectangle alignmentRectangle = new Rectangle(location, size);

            this.showing = false;
            if (isLoaded)
            {
                this.RootElement.InvalidateMeasure(true);
                this.RootElement.UpdateLayout();
                this.Size = this.RootElement.DesiredSize.ToSize();
            }
            this.ShowPopup(alignmentRectangle);
            if (!isLoaded)
            {
                return;
            }
            this.RootElement.InvalidateMeasure(true);
            this.RootElement.UpdateLayout();
            this.Size = this.RootElement.DesiredSize.ToSize();
        }