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 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); } } }