protected override void UpdateControlPositionsCore() { base.UpdateControlPositionsCore(); PopupContainerEditCustomButton currentEditor = OwnerEdit as PopupContainerEditCustomButton; PopupFormCustomButtonsViewInfo currentViewInfo = (ViewInfo as PopupFormCustomButtonsViewInfo); if (currentEditor != null) { Rectangle customButtonsBound = currentViewInfo.CustomButtonsRect; int buttonsForPopupWindowCount = currentEditor.Properties.ButtonsForPopupWindow.Count; if (buttonsForPopupWindowCount > 0) { int iMaxCustomButtonWidth = (customButtonsBound.Width - (buttonsForPopupWindowCount - 1) * PopupFormCustomButtonsViewInfo.sideIndent) / buttonsForPopupWindowCount; int iCurrentX = customButtonsBound.X; if (currentEditor.Properties.ShowCustomButton) { fShowOkButton = false; fCloseButtonStyle = BlobCloseButtonStyle.None; foreach (SimplePopupButton customButton in currentEditor.Properties.ButtonsForPopupWindow) { int iCurrentCustomButtonWidth = customButton.Size.Width; if (iCurrentCustomButtonWidth > iMaxCustomButtonWidth) { iCurrentCustomButtonWidth = iMaxCustomButtonWidth; } customButton.Bounds = new Rectangle(iCurrentX, customButtonsBound.Y, iCurrentCustomButtonWidth, customButtonsBound.Height); Controls.Add(customButton); iCurrentX += iCurrentCustomButtonWidth + PopupFormCustomButtonsViewInfo.sideIndent; if (customButton.DefaultBehavior == PopupButtonStyle.Ok) { customButton.Click += new EventHandler(customButton_OkClick); } if (customButton.DefaultBehavior == PopupButtonStyle.Close) { customButton.Click += new EventHandler(customButton_CancelClick); } } } } } }
protected override void Dispose(bool disposing) { PopupContainerEditCustomButton currentEditor = OwnerEdit as PopupContainerEditCustomButton; if (currentEditor != null) { foreach (SimplePopupButton sbCustomButton in currentEditor.Properties.ButtonsForPopupWindow) { if (Controls.Contains(sbCustomButton)) { Controls.Remove(sbCustomButton); if (sbCustomButton.DefaultBehavior == PopupButtonStyle.Ok) { sbCustomButton.Click -= new EventHandler(customButton_OkClick); } if (sbCustomButton.DefaultBehavior == PopupButtonStyle.Close) { sbCustomButton.Click -= new EventHandler(customButton_CancelClick); } } } } base.Dispose(disposing); }
public PopupContainerFormCustomButton(PopupContainerEditCustomButton ownerEdit) : base(ownerEdit) { }