private void UpdateScreenTipSizeAndShape(IScreenTipContent content) { RadScreenTipElement element = (RadScreenTipElement)content; if (element.TipSize != Size.Empty) { element.MinSize = element.TipSize; element.MaxSize = new Size(element.TipSize.Width, element.MaxSize.Height); } this.radScreenTipControl1.Size = Screen.FromPoint(Control.MousePosition).WorkingArea.Size; this.radScreenTipControl1.SetScreenTipElement(element); this.radScreenTipControl1.LoadElementTree(); this.radScreenTipControl1.RootElement.InvalidateMeasure(true); this.radScreenTipControl1.RootElement.UpdateLayout(); this.radScreenTipControl1.Size = this.radScreenTipControl1.RootElement.DesiredSize.ToSize(); this.Size = this.radScreenTipControl1.Size; if (this.radScreenTipControl1.RootElement.Shape == null) { return; } if (this.Region != null) { this.Region.Dispose(); } using (GraphicsPath path = this.radScreenTipControl1.RootElement.Shape.CreatePath(this.DisplayRectangle)) this.Region = new Region(path); }
private void UpdateScreenTipSizeAndShape(IScreenTipContent content) { RadScreenTipElement screenTipElement = (RadScreenTipElement)content; if (screenTipElement.TipSize != Size.Empty) { screenTipElement.MinSize = screenTipElement.TipSize; screenTipElement.MaxSize = new Size(screenTipElement.TipSize.Width, screenTipElement.MaxSize.Height); } Point currentMousePosition = Control.MousePosition; Screen currentScreen = Screen.FromPoint(currentMousePosition); this.radScreenTipControl1.Size = currentScreen.WorkingArea.Size; this.radScreenTipControl1.SetScreenTipElement(screenTipElement); this.radScreenTipControl1.LoadElementTree(); this.radScreenTipControl1.RootElement.InvalidateMeasure(true); this.radScreenTipControl1.RootElement.UpdateLayout(); this.radScreenTipControl1.Size = radScreenTipControl1.RootElement.DesiredSize.ToSize(); this.Size = this.radScreenTipControl1.Size; if (this.radScreenTipControl1.RootElement.Shape != null) { if (this.Region != null) { this.Region.Dispose(); } using (GraphicsPath path = this.radScreenTipControl1.RootElement.Shape.CreatePath(this.DisplayRectangle)) { this.Region = new Region(path); } } }
/// <summary> /// Sets the screntip element to be wrapped by this control. /// </summary> /// <param name="element">An instance of <see cref="Telerik.WinControls.RadScreenTipElement">RadScreenTipElement</see></param> public void SetScreenTipElement(RadScreenTipElement element) { if (element == null) { if (content != null) { this.RootElement.Children.Remove(content); content = null; } } else if (content != element && !this.RootElement.Children.Contains(element)) { if (content != null) { this.RootElement.Children.Remove(content); } content = element; this.RootElement.Children.Add(content); } }
public void SetScreenTipElement(RadScreenTipElement element) { if (element == null) { if (this.content != null && this.RootElement.Children.Contains((RadElement)this.content)) { this.RootElement.Children.Remove((RadElement)this.content); } this.content = (RadScreenTipElement)null; } else { if (this.content == element || this.RootElement.Children.Contains((RadElement)element)) { return; } if (this.content != null) { this.RootElement.Children.Remove((RadElement)this.content); } this.content = element; this.RootElement.Children.Add((RadElement)this.content); } }