private void OnDropDownPaint(object sender, System.Windows.Forms.PaintEventArgs e) { Buffer.SetTarget(e.Graphics, e.ClipRectangle); Buffer.Graphics.Clear(System.Drawing.Color.White); CurrentTip.Provider.Renderer.Draw(new System.Windows.Forms.PaintEventArgs(Buffer.Graphics, e.ClipRectangle), CurrentTip, Layout); Buffer.Render(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { if (!IsLayeredWindow) { Buffer.SetTarget(e.Graphics, ClientRectangle); Provider.Renderer.Draw(new System.Windows.Forms.PaintEventArgs(Buffer.Graphics, e.ClipRectangle), DisplayedTip, null); Buffer.Render(); } }
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 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); } }