private void OnMenuItem_DropDownOpening(object sender, CancelEventArgs e) { if (this.IsDesignMode) { return; } RadMenuItemBase radMenuItemBase = sender as RadMenuItemBase; if (radMenuItemBase == null) { return; } RadPopupOpeningEventArgs openingEventArgs = e as RadPopupOpeningEventArgs; if (!(radMenuItemBase.Parent is RadDropDownMenuLayout)) { return; } RadDropDownMenuLayout parent = radMenuItemBase.Parent as RadDropDownMenuLayout; openingEventArgs.CustomLocation = new Point(openingEventArgs.CustomLocation.X, parent.ControlBoundingRectangle.Y + this.DropDownMenu.Location.Y); RadDropDownMenu dropDown = radMenuItemBase.DropDown; Size size = new Size(dropDown.Width, parent.ControlBoundingRectangle.Height); dropDown.MinimumSize = size; }
protected override void CreateChildElements() { base.CreateChildElements(); dropDownMenu = new RadDropDownMenu(); dropDownMenu.PopupOpening += delegate(object sender, CancelEventArgs args) { if (!this.RightToLeft) { return; } RadPopupOpeningEventArgs e = args as RadPopupOpeningEventArgs; if (e != null) { e.CustomLocation = new Point(e.CustomLocation.X - (this.dropDownMenu.Size.Width - this.Size.Width), e.CustomLocation.Y); } }; dropDownMenu.PopupOpened += new RadPopupOpenedEventHandler(dropDownMenu_PopupOpened); dropDownMenu.PopupClosed += new RadPopupClosedEventHandler(dropDownMenu_PopupClosed); this.arrowButton = new RadCommandBarArrowButton(); //this is needed because RadCommandBarSplitButton inherits this class if (this.GetType() == typeof(CommandBarDropDownButton)) { this.arrowButton.Class = "CommandBarDropDownButtonArrow"; } arrowButton.MouseEnter += new EventHandler(arrowButton_MouseEnter); arrowButton.MouseLeave += new EventHandler(arrowButton_MouseLeave); this.Children.Add(arrowButton); }
/// <summary> /// Displays the alert popup on the screen at the specified location. /// </summary> public void Show() { if (DesktopAlertManager.Instance.ContainsAlert(this)) { return; } RadPopupOpeningEventArgs args = new RadPopupOpeningEventArgs(this.popup.Location); this.OnPopupOpening(this, args); if (args.Cancel) { return; } this.popup.Size = this.GetPopupSize(); DesktopAlertManager.Instance.AddAlert(this); this.popup.Show(this.popup.Location); if (!PopupManager.Default.ContainsPopup(this.popup)) { return; } if (this.playSound && this.soundToPlay != null) { this.soundToPlay.Play(); } }
public void Show() { if (DesktopAlertManager.Instance.ContainsAlert(this)) { return; } RadPopupOpeningEventArgs args = new RadPopupOpeningEventArgs(this.popup.Location); this.OnPopupOpening((object)this, args); if (args.Cancel) { return; } SizeF monitorDpi = Telerik.WinControls.NativeMethods.GetMonitorDpi(Screen.FromPoint(this.Popup.Location), Telerik.WinControls.NativeMethods.DpiType.Effective); this.DpiScaleElement.DpiScaleChanged(monitorDpi); Size size = this.GetPopupSize(); if (this.Popup.LastShowDpiScaleFactor.IsEmpty) { size = TelerikDpiHelper.ScaleSize(size, new SizeF(1f / monitorDpi.Width, 1f / monitorDpi.Height)); } this.popup.Size = size; DesktopAlertManager.Instance.AddAlert(this); this.popup.Show(this.popup.Location); if (!PopupManager.Default.ContainsPopup((IPopupControl)this.popup) || !this.playSound || this.soundToPlay == null) { return; } this.soundToPlay.Play(); }
private void menu_DropDownOpening(object sender, CancelEventArgs e) { RadPopupOpeningEventArgs openingEventArgs = e as RadPopupOpeningEventArgs; if (openingEventArgs != null) { openingEventArgs.CustomLocation = this.PointToScreen(this.Location); } this.OnDropDownOpening(e); }
protected virtual void OnPopupOpening(object sender, RadPopupOpeningEventArgs args) { RadPopupOpeningEventHandler handler = this.Events[OpeningEventKey] as RadPopupOpeningEventHandler; if (handler != null) { handler(this, args); } if (args.Cancel) { DesktopAlertManager.Instance.RemoveAlert(this); } }
protected virtual void OnPopupOpening(object sender, RadPopupOpeningEventArgs args) { RadPopupOpeningEventHandler openingEventHandler = this.Events[RadDesktopAlert.OpeningEventKey] as RadPopupOpeningEventHandler; if (openingEventHandler != null) { openingEventHandler((object)this, (CancelEventArgs)args); } if (!args.Cancel) { return; } DesktopAlertManager.Instance.RemoveAlert(this); }
private void OnMenuItem_DropDownOpening(object sender, CancelEventArgs e) { if (this.IsDesignMode) { return; } RadMenuItemBase menuItem = sender as RadMenuItemBase; if (menuItem != null) { RadPopupOpeningEventArgs eventArgs = e as RadPopupOpeningEventArgs; if (menuItem.Parent is RadDropDownMenuLayout) { RadDropDownMenuLayout parentLayout = menuItem.Parent as RadDropDownMenuLayout; eventArgs.CustomLocation = new System.Drawing.Point(eventArgs.CustomLocation.X, parentLayout.ControlBoundingRectangle.Y + this.DropDownMenu.Location.Y); RadDropDownMenu dropDownMenu = menuItem.DropDown; System.Drawing.Size popupSize = new System.Drawing.Size(dropDownMenu.Width, parentLayout.ControlBoundingRectangle.Height); dropDownMenu.MinimumSize = popupSize; } } }