/// <summary> /// Fades the out window. /// </summary> /// <param name="currentKryptonWindow">The current krypton window.</param> /// <param name="nextKryptonWindow">The next krypton window.</param> /// <param name="currentWindow">The current window.</param> /// <param name="nextWindow">The next window.</param> /// <param name="fadeOutSleepTimer">The fade out sleep timer.</param> public void FadeOutWindow(KryptonForm currentKryptonWindow, KryptonForm nextKryptonWindow, Form currentWindow = null, Form nextWindow = null, int fadeOutSleepTimer = 50) { for (FadeOut = 90; FadeOut >= 10; FadeOut += -10) { if (nextWindow != null) { nextWindow.Opacity = FadeOut / 100; nextWindow.Refresh(); } else { nextKryptonWindow.Opacity = FadeOut / 100; nextKryptonWindow.Refresh(); } Thread.Sleep(fadeOutSleepTimer); } if (nextWindow != null) { nextWindow.Show(); } else { nextKryptonWindow.Show(); } }
/// <summary> /// Shows the specified Form as a popup window, keeping the /// Owner's title bar active and preparing to cancel the popup /// should the user click anywhere outside the popup window. /// <para>Typical code to use this message is as follows:</para> /// <code> /// frmPopup popup = new frmPopup(); /// Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom)); /// popupHelper.ShowPopup(this, popup, location); /// </code> /// <para>Put as much initialisation code as possible /// into the popup form's constructor, rather than the <see cref="System.Windows.Forms.Load"/> /// event as this will improve visual appearance.</para> /// </summary> /// <param name="owner">Main form which owns the popup</param> /// <param name="popup">Window to show as a popup</param> /// <param name="location">Location relative to the screen to show the popup at.</param> public void ShowPopup(KryptonForm owner, KryptonForm popup, Point location) { this.owner = owner; this.popup = popup; // Start checking for the popup being cancelled Application.AddMessageFilter(filter); // Set the location of the popup form: popup.StartPosition = FormStartPosition.Manual; popup.Location = location; // Make it owned by the window that's displaying it: owner.AddOwnedForm(popup); // Respond to the Closed event in case the popup // is closed by its own internal means popClosedHandler = new EventHandler(popup_Closed); popup.Closed += popClosedHandler; // Show the popup: this.popupShowing = true; popup.Show(); popup.Activate(); // A little bit of fun. We've shown the popup, // but because we've kept the main window's // title bar in focus the tab sequence isn't quite // right. This can be fixed by sending a tab, // but that on its own would shift focus to the // second control in the form. So send a tab, // followed by a reverse-tab. // Send a Tab command: NativeMethods.keybd_event((byte)Keys.Tab, 0, 0, 0); NativeMethods.keybd_event((byte)Keys.Tab, 0, NativeMethods.KEYEVENTF_KEYUP, 0); // Send a reverse Tab command: NativeMethods.keybd_event((byte)Keys.ShiftKey, 0, 0, 0); NativeMethods.keybd_event((byte)Keys.Tab, 0, 0, 0); NativeMethods.keybd_event((byte)Keys.Tab, 0, NativeMethods.KEYEVENTF_KEYUP, 0); NativeMethods.keybd_event((byte)Keys.ShiftKey, 0, NativeMethods.KEYEVENTF_KEYUP, 0); // Start filtering for mouse clicks outside the popup filter.Popup = popup; }
public void ShowForm(KryptonForm sender) { KryptonHeader kryptonHeader1 = new KryptonHeader(); this.Main_Panel.Panel1.AutoScrollPosition = new Point(10, 10); //sender.ControlBox = false; //sender.StateCommon.Header.Content.ShortText.Font = new System.Drawing.Font("DVB-TTSurekh", 22, FontStyle.Bold); sender.FormBorderStyle = FormBorderStyle.Fixed3D; sender.ShowInTaskbar = false; sender.TopLevel = false; sender.Visible = true; sender.Parent = this.Main_Panel.Panel2; //kryptonHeader1.Values.Heading = sender.Text.ToString(); //kryptonHeader1.Values.Description = ""; //kryptonHeader1.AutoSizeMode = AutoSizeMode.GrowAndShrink; //kryptonHeader1.Location = new Point((Main_Panel.Panel2.Width - sender.Width) / 2,kryptonHeader1.Height); this.Main_Panel.Panel2.Controls.Remove(FindForm()); //clear panel first this.Main_Panel.Panel2.Controls.Add(sender); sender.BringToFront(); sender.Location = new Point((Main_Panel.Panel2.Width - sender.Width) / 2, (Main_Panel.Panel2.Height - sender.Height) / 2); kryptonHeader1.Dock = DockStyle.Top; sender.Show(); }
private KryptonPage NewPage(string name, int image, System.Windows.Forms.Control content) { // Create new page with title and image KryptonPage p = new KryptonPage { Text = name, TextTitle = name, TextDescription = name, ImageSmall = imageListSmall.Images[image] }; // Add the control for display inside the page KryptonForm contentDoc = (KryptonForm)content; contentDoc.Dock = DockStyle.Fill; contentDoc.TopLevel = false; contentDoc.Show(); p.Controls.Add(contentDoc); return(p); }