public override Region GetRegion(Graphics dc, Rectangle rect)
 {
     Region ret;
     if (IsDefined(VisualStyleElement.ToolTip.Balloon.Normal))
     {
         VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Balloon.Normal);
         ret = renderer.GetBackgroundRegion(dc, rect);
     }
     else
         ret = new Region(rect);
     return ret;
 }
		Region ManagedWindowGetWindowRegion (Form form)
		{
			if (form.WindowManager is MdiWindowManager && form.WindowManager.IsMaximized)
				return null;
			VisualStyleElement title_bar_element = ManagedWindowGetTitleBarVisualStyleElement (form.WindowManager);
			if (!VisualStyleRenderer.IsElementDefined (title_bar_element))
				return null;
			VisualStyleRenderer renderer = new VisualStyleRenderer (title_bar_element);
			if (!renderer.IsBackgroundPartiallyTransparent ())
				return null;
			IDeviceContext dc = GetMeasurementDeviceContext ();
			Rectangle title_bar_rectangle = ManagedWindowGetTitleBarRectangle (form.WindowManager);
			Region region = renderer.GetBackgroundRegion (dc, title_bar_rectangle);
			ReleaseMeasurementDeviceContext (dc);
			region.Union (new Rectangle (0, title_bar_rectangle.Bottom, form.Width, form.Height));
			return region;
		}
Esempio n. 3
0
		public void method_0(Point point, string text)
		{
			_toolTip.Text = text;
			var size = Size.Ceiling(_toolTip.method_0(text));
			size.Height += 4;
			size.Width += 4;
			point.Y += 19;
			var screen = Screen.FromPoint(point);
		    if (point.X < screen.Bounds.Left)
		        point.X = screen.Bounds.Left;
		    if (point.X + size.Width > screen.Bounds.Right)
			{
				point.X = screen.Bounds.Right - size.Width;
				if (point.X < screen.Bounds.Left)
				{
					return;
				}
			}
			if (point.Y < screen.Bounds.Top)
			{
				point.Y = screen.Bounds.Top;
			}
			if (point.Y + size.Height > screen.Bounds.Bottom)
			{
				point.Y = screen.Bounds.Bottom - size.Height;
				if (point.Y < screen.Bounds.Top)
				{
					return;
				}
				point.X++;
			}
			Native.SetWindowPos(_toolTip.Handle, new IntPtr(-1), point.X, point.Y, size.Width, size.Height, 80);
			var normal = VisualStyleElement.ToolTip.Standard.Normal;
			if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(normal))
			{
				var renderer = new VisualStyleRenderer(normal);
			    using (var g = _toolTip.CreateGraphics())
			        _toolTip.Region = renderer.GetBackgroundRegion(g, _toolTip.ClientRectangle);
			}
			_toolTip.Invalidate();
			_tooltipShown = true;
		    if (_ownerForm != null)
		        _ownerForm.Deactivate -= OnFormDeactivate;
		    _ownerForm = FindTopContainingForm(_control);
		    if (_ownerForm == null) return;
		    _ownerForm.Deactivate += OnFormDeactivate;
		    _toolTip.Owner = _ownerForm;
		}
 public static Region GetRegion(IDeviceContext dc, Size minSize, Size maxSize, string title, string text, ToolTipIcon icon, Padding padding)
 {
     Region ret;
     Rectangle titleRect;
     Rectangle rect = GetRect(dc, minSize, maxSize, title, text, out titleRect, icon, padding);
     if (Application.RenderWithVisualStyles)
     {
         VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Balloon.Normal);
         ret = renderer.GetBackgroundRegion(dc, rect);
     }
     else
     {
         throw new NotImplementedException();
     }
     return ret;
 }