Browse Source

Fixed SD2-1488: Tooltips not visible on secondary monitor

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3733 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
759f7933a2
  1. 47
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Util/TipPainter.cs

47
src/Libraries/ICSharpCode.TextEditor/Project/Src/Util/TipPainter.cs

@ -15,7 +15,6 @@ namespace ICSharpCode.TextEditor.Util
{ {
const float HorizontalBorder = 2; const float HorizontalBorder = 2;
const float VerticalBorder = 1; const float VerticalBorder = 1;
static RectangleF workingArea = RectangleF.Empty;
//static StringFormat centerTipFormat = CreateTipStringFormat(); //static StringFormat centerTipFormat = CreateTipStringFormat();
@ -24,19 +23,22 @@ namespace ICSharpCode.TextEditor.Util
return GetTipSize(control, graphics, new TipText (graphics, font, description)); return GetTipSize(control, graphics, new TipText (graphics, font, description));
} }
static Rectangle GetWorkingArea(Control control)
{
Form ownerForm = control.FindForm();
if (ownerForm.Owner != null) {
ownerForm = ownerForm.Owner;
}
return Screen.GetWorkingArea(ownerForm);
}
public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData) public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData)
{ {
Size tipSize = Size.Empty; Size tipSize = Size.Empty;
SizeF tipSizeF = SizeF.Empty; SizeF tipSizeF = SizeF.Empty;
if (workingArea == RectangleF.Empty) { RectangleF workingArea = GetWorkingArea(control);
Form ownerForm = control.FindForm();
if (ownerForm.Owner != null) {
ownerForm = ownerForm.Owner;
}
workingArea = Screen.GetWorkingArea(ownerForm);
}
PointF screenLocation = control.PointToScreen(Point.Empty); PointF screenLocation = control.PointToScreen(Point.Empty);
@ -68,14 +70,7 @@ namespace ICSharpCode.TextEditor.Util
Size tipSize = Size.Empty; Size tipSize = Size.Empty;
SizeF tipSizeF = SizeF.Empty; SizeF tipSizeF = SizeF.Empty;
if (workingArea == RectangleF.Empty) { RectangleF workingArea = GetWorkingArea(control);
Form ownerForm = control.FindForm();
if (ownerForm.Owner != null) {
ownerForm = ownerForm.Owner;
}
workingArea = Screen.GetWorkingArea(ownerForm);
}
PointF screenLocation = p; PointF screenLocation = p;
@ -110,14 +105,7 @@ namespace ICSharpCode.TextEditor.Util
PointF screenLocation = control.PointToScreen(Point.Empty); PointF screenLocation = control.PointToScreen(Point.Empty);
if (workingArea == RectangleF.Empty) { RectangleF workingArea = GetWorkingArea(control);
Form ownerForm = control.FindForm();
if (ownerForm.Owner != null) {
ownerForm = ownerForm.Owner;
}
workingArea = Screen.GetWorkingArea(ownerForm);
}
SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2, SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2,
workingArea.Bottom - screenLocation.Y - VerticalBorder * 2); workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);
@ -163,14 +151,7 @@ namespace ICSharpCode.TextEditor.Util
PointF screenLocation = control.PointToScreen(new Point(control.Width, 0)); PointF screenLocation = control.PointToScreen(new Point(control.Width, 0));
if (workingArea == RectangleF.Empty) { RectangleF workingArea = GetWorkingArea(control);
Form ownerForm = control.FindForm();
if (ownerForm.Owner != null) {
ownerForm = ownerForm.Owner;
}
workingArea = Screen.GetWorkingArea(ownerForm);
}
SizeF maxLayoutSize = new SizeF(screenLocation.X - HorizontalBorder * 2, SizeF maxLayoutSize = new SizeF(screenLocation.X - HorizontalBorder * 2,
workingArea.Bottom - screenLocation.Y - VerticalBorder * 2); workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

Loading…
Cancel
Save