protected override void OnDrawWindow(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { System.Drawing.Rectangle rectangle = layout.WindowBounds; System.Drawing.Drawing2D.GraphicsPath graphicsPath = Skybound.VisualTips.Rendering.VisualTipRenderer.CreateRoundRectPath(rectangle, Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported ? 10 : 14, Skybound.VisualTips.Rendering.VisualTipRenderer.BorderCorners.All); using (System.Drawing.Brush brush1 = new System.Drawing.SolidBrush(BackColor)) { e.Graphics.FillPath(brush1, graphicsPath); } using (System.Drawing.Pen pen1 = new System.Drawing.Pen(BorderColor)) { if (Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; } else { pen1.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; } e.Graphics.DrawPath(pen1, graphicsPath); if (Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; } System.Drawing.Point[] pointArr = GetArrowPoints(tip, rectangle); using (System.Drawing.Brush brush2 = new System.Drawing.SolidBrush(BackColor)) { e.Graphics.FillPolygon(brush2, pointArr); } using (System.Drawing.Pen pen2 = new System.Drawing.Pen(BackColor)) { e.Graphics.DrawPolygon(pen2, pointArr); } e.Graphics.DrawLines(pen1, pointArr); } }
protected virtual void OnDrawShadow(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { if (HasShadow(tip) && System.Drawing.Rectangle.Intersect(layout.ShadowBounds, layout.WindowBounds) != layout.ShadowBounds) { Skybound.VisualTips.Rendering.VisualTipRenderer.DrawDropShadow(e.Graphics, layout.ShadowBounds, 8, System.Drawing.Color.FromArgb(128, System.Drawing.Color.Black)); } }
protected override System.Drawing.Region OnCreateMaskRegion(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { System.Drawing.Region region; System.Drawing.Rectangle rectangle = layout.WindowBounds; System.Drawing.Point[] pointArr1 = GetArrowPoints(tip, rectangle); System.Drawing.Point[] pointArr2 = new System.Drawing.Point[6]; if (pointArr1[0].Y == rectangle.Y) { pointArr1.CopyTo(pointArr2, 0); System.Drawing.Point point1 = new System.Drawing.Point(rectangle.X + 10, rectangle.Bottom); pointArr2[5] = new System.Drawing.Point(rectangle.X + 10, rectangle.Bottom); System.Drawing.Point point2 = point1; pointArr2[4] = point1; pointArr2[3] = point2; } else { System.Drawing.Point point3 = new System.Drawing.Point(rectangle.X + 10, rectangle.Y); pointArr2[2] = new System.Drawing.Point(rectangle.X + 10, rectangle.Y); System.Drawing.Point point4 = point3; pointArr2[1] = point3; pointArr2[0] = point4; pointArr1.CopyTo(pointArr2, 3); } using (System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath()) { System.Drawing.Point[] pointArr3 = new System.Drawing.Point[26]; pointArr3[0] = new System.Drawing.Point(rectangle.X, rectangle.Y + 5); pointArr3[1] = new System.Drawing.Point(rectangle.X + 1, rectangle.Y + 3); pointArr3[2] = new System.Drawing.Point(rectangle.X + 2, rectangle.Y + 2); pointArr3[3] = new System.Drawing.Point(rectangle.X + 3, rectangle.Y + 1); pointArr3[4] = new System.Drawing.Point(rectangle.X + 5, rectangle.Y); pointArr3[5] = new System.Drawing.Point(pointArr2[0].X, pointArr2[0].Y); pointArr3[6] = new System.Drawing.Point(pointArr2[1].X, pointArr2[1].Y); pointArr3[7] = new System.Drawing.Point(pointArr2[1].X + 1, pointArr2[1].Y); pointArr3[8] = new System.Drawing.Point(pointArr2[2].X + 1, pointArr2[2].Y); pointArr3[9] = new System.Drawing.Point(rectangle.Right - 5, rectangle.Y); pointArr3[10] = new System.Drawing.Point(rectangle.Right - 2, rectangle.Y + 2); pointArr3[11] = new System.Drawing.Point(rectangle.Right - 1, rectangle.Y + 4); pointArr3[12] = new System.Drawing.Point(rectangle.Right, rectangle.Bottom - 7); pointArr3[13] = new System.Drawing.Point(rectangle.Right - 2, rectangle.Bottom - 3); pointArr3[14] = new System.Drawing.Point(rectangle.Right - 5, rectangle.Bottom - 1); pointArr3[15] = new System.Drawing.Point(rectangle.Right - 6, rectangle.Bottom); pointArr3[16] = new System.Drawing.Point(pointArr2[3].X + 1, pointArr2[3].Y); pointArr3[17] = new System.Drawing.Point(pointArr2[4].X + 1, pointArr2[4].Y); pointArr3[18] = new System.Drawing.Point(pointArr2[4].X, pointArr2[4].Y); pointArr3[19] = new System.Drawing.Point(pointArr2[5].X, pointArr2[5].Y); pointArr3[20] = new System.Drawing.Point(rectangle.X + 5, rectangle.Bottom); pointArr3[21] = new System.Drawing.Point(rectangle.X + 5, rectangle.Bottom - 1); pointArr3[22] = new System.Drawing.Point(rectangle.X + 4, rectangle.Bottom - 1); pointArr3[23] = new System.Drawing.Point(rectangle.X + 2, rectangle.Bottom - 3); pointArr3[24] = new System.Drawing.Point(rectangle.X + 1, rectangle.Bottom - 4); pointArr3[25] = new System.Drawing.Point(rectangle.X, rectangle.Bottom - 6); graphicsPath.AddLines(pointArr3); region = new System.Drawing.Region(graphicsPath); } return(region); }
protected override System.Drawing.Region OnCreateMaskRegion(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { if (Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault() != null) { return(Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault().OnCreateMaskRegion(tip, layout)); } return(base.OnCreateMaskRegion(tip, layout)); }
protected override System.Drawing.Color GetElementTextColor(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipRenderElement element) { if (Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault() != null) { return(Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault().GetElementTextColor(tip, element)); } return(base.GetElementTextColor(tip, element)); }
protected string GetBodyText(Skybound.VisualTips.VisualTip tip) { ValidateTip(tip); if (tip.Enabled || (tip.DisabledText.Length <= 0)) { return(tip.Text); } return(tip.DisabledText); }
public System.Drawing.Region CreateMaskRegion(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { ValidateTip(tip); if (layout == null) { layout = OnCreateLayout(tip); } return(OnCreateMaskRegion(tip, layout)); }
private void ValidateParameters(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, ref Skybound.VisualTips.Rendering.VisualTipLayout layout) { ValidatePaintEventArgs(e); ValidateTip(tip); if (layout == null) { layout = CreateLayout(tip); } }
protected virtual System.Drawing.Font GetElementFont(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipRenderElement element) { ValidateTip(tip); if ((element == Skybound.VisualTips.Rendering.VisualTipRenderElement.Title) || (element == Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage) || (element == Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText)) { return(new System.Drawing.Font(tip.Font, System.Drawing.FontStyle.Bold)); } return(tip.Font); }
public void Draw(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { ValidateParameters(e, tip, ref layout); OnDrawShadow(e, tip, layout); OnDrawWindow(e, tip, layout); foreach (Skybound.VisualTips.Rendering.VisualTipRenderElement visualTipRenderElement in System.Enum.GetValues(typeof(Skybound.VisualTips.Rendering.VisualTipRenderElement))) { OnDrawElement(e, tip, layout, visualTipRenderElement); } }
public Skybound.VisualTips.Rendering.VisualTipLayout CreateLayout(Skybound.VisualTips.VisualTip tip) { ValidateTip(tip); Skybound.VisualTips.Rendering.VisualTipLayout visualTipLayout = OnCreateLayout(tip); if (visualTipLayout == null) { throw new System.InvalidOperationException("A null value may not be returned by OnCreateLayout."); } return(visualTipLayout); }
private void ValidateTip(Skybound.VisualTips.VisualTip tip) { if (tip == null) { throw new System.ArgumentNullException("tip"); } if (tip.Provider == null) { throw new System.ArgumentException("The tip must be associated with a VisualTipProvider before it is rendered."); } }
protected override void OnDrawShadow(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { if (HasShadow(tip) && System.Drawing.Rectangle.Intersect(layout.ShadowBounds, layout.WindowBounds) != layout.ShadowBounds) { System.Drawing.Rectangle rectangle = layout.ShadowBounds; rectangle.X += 4; rectangle.Width -= 4; rectangle.Y += 16; rectangle.Height -= 28; Skybound.VisualTips.Rendering.VisualTipRenderer.DrawDropShadow(e.Graphics, rectangle, 12, System.Drawing.Color.FromArgb(128, System.Drawing.Color.Black)); } }
protected System.Drawing.Size MeasureElement(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipRenderElement element, int maximumWidth) { ValidateTip(tip); if (element == Skybound.VisualTips.Rendering.VisualTipRenderElement.Image) { if (tip.Image != null) { return(tip.Image.Size); } return(System.Drawing.Size.Empty); } if (element == Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterImage) { if (tip.FooterImage != null) { return(tip.FooterImage.Size); } return(System.Drawing.Size.Empty); } if (element == Skybound.VisualTips.Rendering.VisualTipRenderElement.TitleImage) { if (tip.TitleImage != null) { return(tip.TitleImage.Size); } return(System.Drawing.Size.Empty); } string s = null; switch (element) { case Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage: s = tip.DisabledMessage; break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText: s = tip.FooterText; break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.Text: s = GetBodyText(tip); break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.Title: s = GetTitleText(tip); break; } if (s != null) { return(MeasureText(s, GetElementFont(tip, element), tip.Provider.MaximumWidth)); } return(System.Drawing.Size.Empty); }
protected bool HasFooter(Skybound.VisualTips.VisualTip tip) { ValidateTip(tip); if (!tip.HideFooter) { if (tip.FooterText.Length <= 0) { return(tip.FooterImage != null); } return(true); } return(false); }
protected string GetTitleText(Skybound.VisualTips.VisualTip tip) { ValidateTip(tip); string s = ""; if (tip.Shortcut != System.Windows.Forms.Shortcut.None) { s = "(" + System.ComponentModel.TypeDescriptor.GetConverter(typeof(System.Windows.Forms.Keys)).ConvertToString(tip.Shortcut) + ")"; } if (tip.Title.Length <= 0) { return(s); } return(tip.Title + " " + s); }
protected bool HasShadow(Skybound.VisualTips.VisualTip tip) { ValidateTip(tip); if (Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported) { if (tip.Provider.Shadow == Skybound.VisualTips.VisualTipShadow.Enabled) { return(true); } if (tip.Provider.Shadow == Skybound.VisualTips.VisualTipShadow.SystemDefault) { return(Skybound.VisualTips.SystemParameters.ToolTipShadow); } } return(false); }
private System.Drawing.Point[] GetArrowPoints(Skybound.VisualTips.VisualTip tip, System.Drawing.Rectangle window) { System.Drawing.Rectangle rectangle = tip.GetRelativeToolArea(); int i = System.Math.Min(System.Math.Max(rectangle.X, window.X + 16), window.Right - 32); bool flag = i > (window.X + (window.Width / 2)); if (rectangle.Y <= 0) { System.Drawing.Point[] pointArr1 = new System.Drawing.Point[3]; pointArr1[0] = new System.Drawing.Point(i, window.Y); pointArr1[1] = new System.Drawing.Point(i + (flag ? 16 : 0), window.Y - 16); pointArr1[2] = new System.Drawing.Point(i + 16, window.Y); return(pointArr1); } System.Drawing.Point[] pointArr2 = new System.Drawing.Point[3]; pointArr2[0] = new System.Drawing.Point(i + 16, window.Bottom - 1); pointArr2[1] = new System.Drawing.Point(i + (flag ? 16 : 0), window.Bottom - 1 + 16); pointArr2[2] = new System.Drawing.Point(i, window.Bottom - 1); return(pointArr2); }
protected override System.Drawing.Region OnCreateMaskRegion(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { if (RoundCorners) { System.Drawing.Rectangle rectangle = layout.WindowBounds; rectangle.Width++; rectangle.Height++; System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); System.Drawing.Point[] pointArr = new System.Drawing.Point[8]; pointArr[0] = new System.Drawing.Point(rectangle.X + 2, rectangle.Y); pointArr[1] = new System.Drawing.Point(rectangle.Right - 3, rectangle.Y); pointArr[2] = new System.Drawing.Point(rectangle.Right - 1, rectangle.Y + 2); pointArr[3] = new System.Drawing.Point(rectangle.Right - 1, rectangle.Bottom - 4); pointArr[4] = new System.Drawing.Point(rectangle.Right - 4, rectangle.Bottom - 1); pointArr[5] = new System.Drawing.Point(rectangle.X + 2, rectangle.Bottom - 1); pointArr[6] = new System.Drawing.Point(rectangle.X, rectangle.Bottom - 4); pointArr[7] = new System.Drawing.Point(rectangle.X, rectangle.Y + 2); graphicsPath.AddPolygon(pointArr); return(new System.Drawing.Region(graphicsPath)); } return(base.OnCreateMaskRegion(tip, layout)); }
protected override Skybound.VisualTips.Rendering.VisualTipLayout OnCreateLayout(Skybound.VisualTips.VisualTip tip) { Skybound.VisualTips.Rendering.VisualTipLayout visualTipLayout = base.OnCreateLayout(tip); visualTipLayout.OffsetWindow(4, 18); visualTipLayout.WindowBounds = System.Drawing.Rectangle.Inflate(visualTipLayout.WindowBounds, 4, 2); System.Drawing.Rectangle rectangle1 = visualTipLayout.ShadowBounds; System.Drawing.Rectangle rectangle2 = visualTipLayout.ShadowBounds; visualTipLayout.ShadowBounds = new System.Drawing.Rectangle(rectangle1.Location, rectangle2.Size + (new System.Drawing.Size(8, 32))); return(visualTipLayout); }
protected override void OnDrawWindow(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { if (Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault() == null) { base.OnDrawWindow(e, tip, layout); return; } Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault().OnDrawWindow(e, tip, layout); }
protected virtual void OnDrawWindow(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { System.Drawing.Rectangle rectangle = layout.WindowBounds; e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Info, rectangle); e.Graphics.DrawRectangle(System.Drawing.SystemPens.InfoText, new System.Drawing.Rectangle(rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1)); }
protected virtual void OnDrawElement(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout, Skybound.VisualTips.Rendering.VisualTipRenderElement element) { System.Drawing.Rectangle rectangle1 = layout.GetElementBounds(element); string s = ""; System.Drawing.Image image = null; System.Drawing.Size size = rectangle1.Size; if (size.IsEmpty) { return; } switch (element) { case Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage: s = tip.DisabledMessage; break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText: s = tip.FooterText; break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.Text: s = GetBodyText(tip); break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.Title: s = GetTitleText(tip); break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.TitleImage: image = tip.TitleImage; break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.Image: image = tip.Image; break; case Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterImage: image = tip.FooterImage; break; } if (s.Length > 0) { using (Skybound.Windows.Forms.BufferedGraphics bufferedGraphics = new Skybound.Windows.Forms.BufferedGraphics()) { bufferedGraphics.SetTarget(e.Graphics, rectangle1); System.Drawing.Rectangle rectangle2 = new System.Drawing.Rectangle(0, 0, rectangle1.Width, rectangle1.Height); layout.Offset(-rectangle1.X, -rectangle1.Y); OnDrawWindow(new System.Windows.Forms.PaintEventArgs(bufferedGraphics.Graphics, rectangle2), tip, layout); layout.Offset(rectangle1.X, rectangle1.Y); Skybound.Windows.Forms.TextFormatFlags textFormatFlags = Skybound.Windows.Forms.TextFormatFlags.NoPrefix | Skybound.Windows.Forms.TextFormatFlags.WordBreak; if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { textFormatFlags = (Skybound.Windows.Forms.TextFormatFlags)(textFormatFlags | (Skybound.Windows.Forms.TextFormatFlags.Right | Skybound.Windows.Forms.TextFormatFlags.RightToLeft)); } Skybound.Windows.Forms.TextRenderer.DrawText(bufferedGraphics.Graphics, s, GetElementFont(tip, element), GetElementTextColor(tip, element), System.Drawing.Color.Transparent, rectangle2, textFormatFlags); bufferedGraphics.Render(); return; } } if (image != null) { e.Graphics.DrawImage(image, rectangle1); } }
protected virtual System.Drawing.Region OnCreateMaskRegion(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { return(null); }
protected virtual Skybound.VisualTips.Rendering.VisualTipLayout OnCreateLayout(Skybound.VisualTips.VisualTip tip) { Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout2; Skybound.VisualTips.Rendering.VisualTipLayout visualTipLayout = new Skybound.VisualTips.Rendering.VisualTipLayout(); string s1 = GetTitleText(tip); string s2 = GetBodyText(tip); bool flag1 = s1.Length > 0; bool flag2 = (s2.Length > 0) || (tip.Image != null); System.Drawing.Font font1 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Title); System.Drawing.Font font2 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text); System.Drawing.Font font3 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText); System.Drawing.Font font4 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage); System.Drawing.Size size1 = MeasureText(s1, font1, 0); int i1 = flag1 ? size1.Width : 0; System.Drawing.Size size2 = MeasureText(s2, font2, 0); int i2 = flag2 ? size2.Width : 0; System.Drawing.Size size3 = MeasureText(tip.FooterText, font3, 0); int i3 = HasFooter(tip) ? size3.Width : 0; if (!tip.Enabled && (tip.DisabledMessage.Length > 0)) { System.Drawing.Size size4 = MeasureText(tip.DisabledMessage, font4, 0); i2 = System.Math.Max(size4.Width, i2); } if (tip.TitleImage != null) { i1 += tip.TitleImage.Width + 6; } if (tip.Image != null) { i2 += tip.Image.Width + 6; } if (HasFooter(tip) && (tip.FooterImage != null)) { i3 += tip.FooterImage.Width + 6; } int i4 = System.Math.Max(System.Math.Max(i1, i2), i3); int i5 = System.Math.Min(tip.MaximumWidth - 6 - 6, i4); int i6 = 6; Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout1 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.TitleImage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Title), s1, null, "", i5, 6); imageAndTextLayout1.Offset(6, 6); if (imageAndTextLayout1.Bounds.Height > 0) { i6 += imageAndTextLayout1.Bounds.Height + 6; } if (tip.Enabled) { imageAndTextLayout2 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.Image, null, "", GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text), s2, i5, 6); } else { imageAndTextLayout2 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.Image, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage), tip.DisabledMessage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text), s2, i5, 6); } imageAndTextLayout2.Offset(6, i6); if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { imageAndTextLayout2.SwapRtl(); } if (imageAndTextLayout2.Bounds.Height > 0) { i6 += imageAndTextLayout2.Bounds.Height + 6; } Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout3 = HasFooter(tip) ? new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.FooterImage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText), tip.FooterText, null, "", i5, 6) : new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, null, null, "", null, "", i5, 6); imageAndTextLayout3.Offset(6, i6); if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { imageAndTextLayout3.SwapRtl(); } if (imageAndTextLayout3.Bounds.Height > 0) { imageAndTextLayout3.Offset(0, 6); } visualTipLayout.WindowBounds = new System.Drawing.Rectangle(0, 0, 6 + i5 + 6, imageAndTextLayout3.Bounds.Bottom + (HasFooter(tip) ? 6 : 0)); visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.TitleImage, imageAndTextLayout1.ImageBounds); visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Title, imageAndTextLayout1.TextBounds); visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Image, imageAndTextLayout2.ImageBounds); visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterImage, imageAndTextLayout3.ImageBounds); visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText, imageAndTextLayout3.TextBounds); if (imageAndTextLayout2.TitleTextHeight > 0) { System.Drawing.Rectangle rectangle1 = imageAndTextLayout2.TextBounds; rectangle1.Height = imageAndTextLayout2.TitleTextHeight; visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage, rectangle1); rectangle1.Y = rectangle1.Bottom; rectangle1.Height = imageAndTextLayout2.TextBounds.Height - imageAndTextLayout2.TitleTextHeight; visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Text, rectangle1); } else { visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage, System.Drawing.Rectangle.Empty); visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Text, imageAndTextLayout2.TextBounds); } if (HasShadow(tip)) { System.Drawing.Rectangle rectangle2 = visualTipLayout.WindowBounds; System.Drawing.Rectangle rectangle3 = visualTipLayout.WindowBounds; visualTipLayout.ShadowBounds = new System.Drawing.Rectangle(rectangle2.Location, rectangle3.Size + (new System.Drawing.Size(5, 5))); if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { visualTipLayout.OffsetWindow(5, 0); } } else { visualTipLayout.ShadowBounds = visualTipLayout.WindowBounds; } return(visualTipLayout); }
protected override System.Drawing.Color GetElementTextColor(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipRenderElement element) { return(TextColor); }
protected virtual System.Drawing.Color GetElementTextColor(Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipRenderElement element) { ValidateTip(tip); return(System.Drawing.SystemColors.InfoText); }
protected override void OnDrawWindow(System.Windows.Forms.PaintEventArgs e, Skybound.VisualTips.VisualTip tip, Skybound.VisualTips.Rendering.VisualTipLayout layout) { System.Drawing.Drawing2D.GraphicsPath graphicsPath1; System.Drawing.Rectangle rectangle1 = layout.WindowBounds; bool flag = BackgroundEffect == Skybound.VisualTips.Rendering.VisualTipOfficeBackgroundEffect.Glass; if (RoundCorners) { graphicsPath1 = Skybound.VisualTips.Rendering.VisualTipRenderer.CreateRoundRectPath(rectangle1, Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported ? 5 : 7, Skybound.VisualTips.Rendering.VisualTipRenderer.BorderCorners.All); } else { graphicsPath1 = new System.Drawing.Drawing2D.GraphicsPath(); graphicsPath1.AddRectangle(new System.Drawing.Rectangle(rectangle1.Location, rectangle1.Size - (new System.Drawing.Size(1, 1)))); } using (System.Drawing.Brush brush = new System.Drawing.Drawing2D.LinearGradientBrush(rectangle1, BackColor, BackColorGradient, (float)(GradientAngle + (flag ? 180 : 0)), false)) { e.Graphics.FillPath(brush, graphicsPath1); } if (flag) { System.Drawing.Color color3 = BackColor; int i1 = (int)((1.0F - ((1.0F - color3.GetBrightness()) * 0.75F)) * 255.0F); System.Drawing.Color color1 = System.Drawing.Color.FromArgb(i1, i1, i1); using (System.Drawing.Drawing2D.LinearGradientBrush linearGradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(rectangle1, System.Drawing.Color.FromArgb(128, color1), System.Drawing.Color.FromArgb(0, color1), System.Drawing.Drawing2D.LinearGradientMode.Vertical)) using (System.Drawing.Drawing2D.GraphicsPath graphicsPath2 = CreateGlarePath(rectangle1, Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported ? 5 : 7)) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; e.Graphics.FillPath(linearGradientBrush, graphicsPath2); e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; } } using (System.Drawing.Pen pen1 = new System.Drawing.Pen(BorderColor)) { if (Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; } else { pen1.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; } e.Graphics.DrawPath(pen1, graphicsPath1); if (Skybound.VisualTips.Rendering.VisualTipRenderer.LayeredWindowsSupported) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; } } if (HasFooter(tip)) { System.Drawing.Rectangle rectangle2 = layout.GetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterImage); int i2 = rectangle2.Top - 6; System.Drawing.Color color4 = BackColorGradient; System.Drawing.Color color5 = BackColorGradient; System.Drawing.Color color6 = BackColorGradient; System.Drawing.Color color2 = System.Drawing.Color.FromArgb((int)((float)color4.R * 0.9F), (int)((float)color5.G * 0.9F), (int)((float)color6.B * 0.9F)); using (System.Drawing.Pen pen2 = new System.Drawing.Pen(color2)) { e.Graphics.DrawLine(pen2, rectangle1.X + 5, i2, rectangle1.Right - 6, i2); pen2.Color = System.Windows.Forms.ControlPaint.Light(BackColor); e.Graphics.DrawLine(pen2, rectangle1.X + 5, i2 + 1, rectangle1.Right - 6, i2 + 1); } } }
protected override Skybound.VisualTips.Rendering.VisualTipLayout OnCreateLayout(Skybound.VisualTips.VisualTip tip) { if (Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault() != null) { return(Skybound.VisualTips.Rendering.VisualTipRenderer.GetDefault().OnCreateLayout(tip)); } return(base.OnCreateLayout(tip)); }