private void DoBeforeShow() { // multiple monitor support MultiMonitorVisualDisplay d = (MultiMonitorVisualDisplay)this.Tag; Screen screen = d.GetPreferredDisplay(); // set initial location this.leftXLocation = screen.WorkingArea.Left; this.rightXLocation = screen.WorkingArea.Right - this.Width; this.topYLocation = screen.WorkingArea.Top; this.bottomYLocation = screen.WorkingArea.Bottom - this.Height; switch (location) { case NotifyDisplay.Location.TopLeft: this.Location = new Point(this.leftXLocation, this.topYLocation); break; case NotifyDisplay.Location.BottomLeft: this.Location = new Point(this.leftXLocation, this.bottomYLocation); break; case NotifyDisplay.Location.BottomRight: this.Location = new Point(this.rightXLocation, this.bottomYLocation); break; default: // TopRight this.Location = new Point(this.rightXLocation, this.topYLocation); break; } }
void VisorWindow_Load(object sender, EventArgs e) { // multiple monitor support MultiMonitorVisualDisplay d = (MultiMonitorVisualDisplay)this.Tag; this.screen = d.GetPreferredDisplay(); // set size & location this.Width = screen.Bounds.Width; this.Location = screen.Bounds.Location; this.titleLabel.Width = this.Width / 2; this.descriptionLabel.Width = this.Width / 2; // set initial opacity this.Opacity = 0.90; }
void StandardWindow_Load(object sender, EventArgs e) { /* * // set initial location * int screenIndex = 0; * string s = System.Configuration.ConfigurationManager.AppSettings["ScreenIndex"]; * if (!String.IsNullOrEmpty(s)) * { * int.TryParse(s, out screenIndex); * if (Screen.AllScreens.Length <= screenIndex) screenIndex = 0; * } * * Screen screen = Screen.AllScreens[screenIndex]; * */ // multiple monitor support MultiMonitorVisualDisplay d = (MultiMonitorVisualDisplay)this.Tag; Screen screen = d.GetPreferredDisplay(); int x = screen.WorkingArea.Right - this.Size.Width; int y = screen.WorkingArea.Bottom - this.Size.Height; this.Location = new Point(x, y); // set initial opacity //this.Opacity = 0.98; }
void ToastWindow_Load(object sender, EventArgs e) { // multiple monitor support MultiMonitorVisualDisplay d = (MultiMonitorVisualDisplay)this.Tag; Screen screen = d.GetPreferredDisplay(); int x = screen.WorkingArea.Right - this.Size.Width; int y = screen.WorkingArea.Bottom - this.Size.Height; this.Location = new Point(x, y); }
void RisorWindow_Load(object sender, EventArgs e) { // multiple monitor support MultiMonitorVisualDisplay d = (MultiMonitorVisualDisplay)this.Tag; this.screen = d.GetPreferredDisplay(); // set size & location this.Width = screen.Bounds.Width; this.Location = new Point(this.Location.X, this.screen.Bounds.Bottom - 10); // the extra 10 is so that at least part of the form is on the screen initially, otherwise the opacity goes all screwy // set initial opacity this.Opacity = 0.90; }
private void DoBeforeShow() { // multiple monitor support MultiMonitorVisualDisplay d = (MultiMonitorVisualDisplay)this.Tag; Screen screen = d.GetPreferredDisplay(); // set initial location this.leftXLocation = screen.WorkingArea.Left; this.rightXLocation = screen.WorkingArea.Right - this.Width; this.topYLocation = screen.WorkingArea.Top; this.bottomYLocation = screen.WorkingArea.Bottom - this.Height; this.width = this.Width; this.height = this.Height - arrowSize; switch (location) { case SmokestackDisplay.Location.TopLeft: borderTopOffset = arrowSize; this.Location = new Point(this.leftXLocation, this.topYLocation); arrowBrush = new SolidBrush(color1); arrowLeft = arrowOffset; arrowTop = 0; arrowXOffset = 0; arrowYOffset = 1; Point tl1 = new Point(arrowLeft, arrowTop + arrowSize); Point tl2 = new Point(arrowLeft + arrowSize, arrowTop); Point tl3 = new Point(arrowLeft + arrowSize + arrowSize, arrowTop + arrowSize); points = new Point[] { tl1, tl2, tl3, tl1 }; break; case SmokestackDisplay.Location.BottomLeft: this.Location = new Point(this.leftXLocation, this.bottomYLocation); arrowBrush = new SolidBrush(color2); arrowLeft = arrowOffset; arrowTop = height - 1; arrowXOffset = 0; arrowYOffset = -1; Point bl1 = new Point(arrowLeft, arrowTop); Point bl2 = new Point(arrowLeft + arrowSize, arrowTop + arrowSize); Point bl3 = new Point(arrowLeft + arrowSize + arrowSize, arrowTop); points = new Point[] { bl1, bl2, bl3, bl1 }; break; case SmokestackDisplay.Location.BottomRight: this.Location = new Point(this.rightXLocation, this.bottomYLocation); arrowBrush = new SolidBrush(color2); arrowLeft = width - arrowOffset - arrowSize - arrowSize; arrowTop = height - 1; arrowXOffset = 0; arrowYOffset = -1; Point br1 = new Point(arrowLeft, arrowTop); Point br2 = new Point(arrowLeft + arrowSize, arrowTop + arrowSize); Point br3 = new Point(arrowLeft + arrowSize + arrowSize, arrowTop); points = new Point[] { br1, br2, br3, br1 }; break; default: // TopRight borderTopOffset = arrowSize; this.Location = new Point(this.rightXLocation, this.topYLocation); arrowBrush = new SolidBrush(color1); arrowLeft = width - arrowOffset - arrowSize - arrowSize; arrowTop = 0; arrowXOffset = 0; arrowYOffset = 1; Point tp1 = new Point(arrowLeft, arrowTop + arrowSize); Point tp2 = new Point(arrowLeft + arrowSize, arrowTop); Point tp3 = new Point(arrowLeft + arrowSize + arrowSize, arrowTop + arrowSize); points = new Point[] { tp1, tp2, tp3, tp1 }; break; } this.panel1.Top = borderTopOffset; Region r = Growl.DisplayStyle.Utility.CreateRoundedRegion(0, borderTopOffset, width, height + borderTopOffset, radius, radius); GraphicsPath gp = new GraphicsPath(); gp.AddPolygon(points); r.Union(gp); this.Region = r; }