private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { if (e.AssociatedControl == this.pnlMain) { e.DrawBackground(); e.Graphics.FillRectangle(Brushes.GhostWhite, e.Bounds); // Draw a border to appear 3-dimensional. e.Graphics.DrawLines(SystemPens.ControlLightLight, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(0, 0), new Point(e.Bounds.Width - 1, 0) }); e.Graphics.DrawLines(SystemPens.Control, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, 0) }); e.Graphics.DrawString( e.ToolTipText, this._tooltipFont, Program.SecularDayBrush, new RectangleF(e.Bounds.X - 20, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), this._tooltipStringFormat); } else { e.DrawBackground(); e.DrawBorder(); e.DrawText(); } }
static void ToolTip2_Draw(object sender, DrawToolTipEventArgs e) { Debug.Assert(BidiHelper.IsRightToLeft, "Tooltip2 should only be ownerdraw when running RTL"); e.DrawBackground(); e.DrawBorder(); e.DrawText(TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.RightToLeft | TextFormatFlags.Right); }
private void saveTip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); _helpMessage = e.ToolTipText; e.Graphics.DrawString(e.ToolTipText, saveLoad.Font, Brushes.Black, new PointF(2, 2)); }
private void toolTip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); //e.DrawBorder(); //e.Graphics.DrawLines(new Pen(new SolidBrush((Color)Properties.Settings.Default["Outline"]), 4), new Point[] { // new Point (0, e.Bounds.Height - 1), // new Point (0, 0), // new Point (e.Bounds.Width - 1, 0) // }); //e.Graphics.DrawLines(new Pen(new SolidBrush((Color)Properties.Settings.Default["Outline"]), 3), new Point[] { // new Point (0, e.Bounds.Height - 1), // new Point (e.Bounds.Width - 1, e.Bounds.Height - 1), // new Point (e.Bounds.Width - 1, 0) // }); //e.DrawText(); using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; sf.FormatFlags = StringFormatFlags.NoWrap; using (Font f = new Font("Segoe", 10f, FontStyle.Bold)) { e.Graphics.DrawString(e.ToolTipText, f, new SolidBrush((Color)Properties.Settings.Default["Color_FG"]), e.Bounds, sf); } } }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); toolTip1.BackColor = Color.Black; e.DrawBorder(); SolidBrush br0 = new SolidBrush(Color.White); SolidBrush br1 = new SolidBrush(Color.FromArgb(0, 255, 0)); SolidBrush br2 = new SolidBrush(Color.FromArgb(0, 255, 255)); SolidBrush br3 = new SolidBrush(Color.FromArgb(255, 165, 0)); SolidBrush br4 = new SolidBrush(Color.FromArgb(255, 255, 0)); string txt = e.ToolTipText; Font f = new Font("Segoe UI", 11); Font f1 = new Font("Segoe UI", 9); string[] txt2 = txt.Split('\n'); string para1; string para2; string para3; string para4; if (txt2[1] != "NA" && !string.IsNullOrEmpty(txt2[1])) { para1 = Convert.ToDouble(txt2[1]).ToString("0.00"); } else { para1 = txt2[1]; } if (txt2[2] != "NA" && !string.IsNullOrEmpty(txt2[2])) { para2 = Convert.ToDouble(txt2[2]).ToString("0.00"); } else { para2 = txt2[2]; } if (txt2[3] != "NA" && !string.IsNullOrEmpty(txt2[3])) { para3 = Convert.ToDouble(txt2[3]).ToString("0.00"); } else { para3 = txt2[3]; } if (txt2[4] != "NA" && !string.IsNullOrEmpty(txt2[4])) { para4 = Convert.ToDouble(txt2[4]).ToString("0.00"); } else { para4 = txt2[4]; } e.Graphics.DrawString(txt2[0], f1, br0, 5, 0); e.Graphics.DrawString(strCaptal1 + " " + para1, f, br1, 5, 16); e.Graphics.DrawString(strCaptal2 + " " + para2, f, br2, 5, 36); e.Graphics.DrawString(strCaptal3 + " " + para3, f, br3, 5, 56); e.Graphics.DrawString(strCaptal4 + " " + para4, f, br4, 5, 76); }
private void toolTip2_Draw(object sender, DrawToolTipEventArgs e) { // Draw the background and border. e.DrawBackground(); e.DrawBorder(); // Draw the image. e.Graphics.DrawImage(Properties.Resources.Hund, Margin, Margin); // Draw the text. using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; int image_wid = 2 * Margin + Properties.Resources.Hund.Width; Rectangle rect = new Rectangle(image_wid, 0, e.Bounds.Width - image_wid, e.Bounds.Height); e.Graphics.DrawString( e.ToolTipText, e.Font, Brushes.Aqua, rect, sf); } }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { Color c = Color.Lime; switch (tabControl1.SelectedIndex) { case 0: c = Color.LightSkyBlue; break; case 1: c = Color.Honeydew; break; case 2: c = Color.Maroon; break; default: break; } switch ((string)e.AssociatedControl.Parent.Tag) { case "1": toolTip1.BackColor = Color.FromArgb(21, 9, 9); break; case "2": toolTip1.BackColor = Color.FromArgb(16, 12, 38); break; case "3": toolTip1.BackColor = Color.FromArgb(47, 13, 26); break; default: break; } e.DrawBackground(); Pen pen = new Pen(c, 3); e.Graphics.DrawLines(pen, new Point[] { new Point(0, e.Bounds.Height + 1), new Point(0, 0), new Point(e.Bounds.Width + 1, 0) }); e.Graphics.DrawLines(pen, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, 0) }); e.Graphics.DrawString(e.ToolTipText, f, Brushes.AntiqueWhite, e.Bounds); }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { if (e.AssociatedControl is PictureBox) { Image img = ((PictureBox)e.AssociatedControl).Image; if (img != null) { //开始绘制图像 e.Graphics.CompositingQuality = CompositingQuality.HighQuality; e.Graphics.DrawImage(img, e.Bounds); LinearGradientBrush linGrBrush = new LinearGradientBrush( new Point(0, 10), new Point(200, 10), Color.FromArgb(255, 255, 0, 0), // Opaque red Color.FromArgb(255, 0, 0, 255)); // Opaque blue Font f = new Font("宋体", 10, FontStyle.Bold); e.Graphics.DrawString("双击打开图像", f, linGrBrush, 2, 2); return; } } //其他控件,或PictureBox无图像时 e.DrawBackground(); e.DrawBorder(); e.DrawText(); }
private void tooltipinfo_Draw(object sender, DrawToolTipEventArgs e) { // MessageBox.Show(e.AssociatedControl.Location.X); // Point p = new Point(e.AssociatedControl.Location.X, e.AssociatedControl.Location.Y); Brush brsh = Brushes.Red; Font font = new Font("Arial", 12, FontStyle.Bold); Point p = new Point(); Rectangle box = new Rectangle(new Point(0, 0), new Size(100, 250)); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawRectangle(Pens.AliceBlue, box); e.DrawBorder(); // e.Graphics.DrawIcon(new Icon(Application.StartupPath + "\\logo.ico"),new Rectangle(new Point(1,1),new Size())); // e.Graphics.DrawString("מידע", font, brsh, new PointF(40,0)); // e.Graphics.DrawString(e.ToolTipText, new Font("Arial", 12), br, new PointF(0,10)); /*string[] spl = e.ToolTipText.Split('\n'); * foreach (string line in spl) * { * if (line.Length > len) * len = line.Length; * } * Rectangle rect = new Rectangle(len * 5 + 30, 0, 24, 24); * e.Graphics.DrawIcon(new Icon(Application.StartupPath + "\\logo.ico"), rect); * e.Graphics.DrawString(e.ToolTipText, new Font("Arial", 12), br, new PointF(20, 20));*/ }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(TextFormatFlags.Default); Report.ReportStatus(e.ToolTipText); }
private void IntelliTip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); Rectangle bounds = Rectangle.FromLTRB(e.Bounds.Left + 6, e.Bounds.Top, e.Bounds.Right - 6, e.Bounds.Bottom); TextRenderer.DrawText(e.Graphics, e.ToolTipText, SystemFonts.MessageBoxFont, bounds, this.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.LeftAndRightPadding); }
void ToolTip_Draw(object sender, DrawToolTipEventArgs e) { System.Drawing.Font f = new System.Drawing.Font("Arial", 13.0f, FontStyle.Bold); e.DrawBackground(); e.DrawBorder(); tooltip_message = e.ToolTipText; e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(9, 0)); }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { //tool tip draw handler //setting backcolor e.DrawBackground(); e.DrawBorder(); e.DrawText(); }
private void toolTipHint_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Arial", 10.0f); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(2f, 2f)); }
public void DrawBackground_Invoke_Success(IWin32Window associatedWindow, Control associatedControl, Rectangle bounds, string toolTipText, Color backColor, Color foreColor, Font font) { using (var image = new Bitmap(10, 10)) using (Graphics graphics = Graphics.FromImage(image)) { var e = new DrawToolTipEventArgs(graphics, associatedWindow, associatedControl, bounds, toolTipText, backColor, foreColor, font); e.DrawBackground(); } }
public void DrawBackground_Invoke_Success() { using (var image = new Bitmap(10, 10)) using (Graphics graphics = Graphics.FromImage(image)) { var e = new DrawToolTipEventArgs(graphics, new SubWin32Window(), new Button(), new Rectangle(1, 2, 3, 4), "tooltipText", Color.Red, Color.Blue, SystemFonts.DefaultFont); e.DrawBackground(); } }
void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Arial", 10.0f); tooltip.BackColor = items[itemsIndex].getColor(); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(2, 2)); }
void toolTip_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Arial", 16.0f); e.DrawBackground(); e.DrawBorder(); tttext = e.ToolTipText; e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(2, 2)); }
public void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Arial", 10.0f); toolTip1.BackColor = System.Drawing.Color.Red; e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(2, 2)); }
private static void toolTip_Draw(object sender, DrawToolTipEventArgs e) { ToolTip t = (ToolTip)sender; t.BackColor = tooltipBgColor; e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, tooltipFont, tooltipFgColor, new PointF(1, 1)); }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); Rectangle rectg = new Rectangle(0, 0, e.Bounds.Width + 1, e.Bounds.Height + 1); e.Graphics.DrawRectangle(Pens.Black, rectg); e.Graphics.DrawString(this.toolTip1.ToolTipTitle + e.ToolTipText, e.Font, Brushes.Black, rectg); }
public void toolTip2_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Candara", 9.0f); toolTip2.BackColor = System.Drawing.Color.White; e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(6, 2)); }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Segoe UI Semibold", 10.0f); labelToolTip.BackColor = Color.Black; labelToolTip.ForeColor = Color.White; e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(2, 2)); }
private void ToolTipDraw(object sender, DrawToolTipEventArgs e) { System.Drawing.Rectangle bounds = e.Bounds; bounds.Height -= 1; DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, e.AssociatedWindow, e.AssociatedControl, bounds, e.ToolTipText, ToolTip.BackColor, ToolTip.ForeColor, e.Font); newArgs.DrawBackground(); newArgs.DrawText(TextFormatFlags.VerticalCenter); }
private void Tlp_Draw(object sender, DrawToolTipEventArgs e) { tlp.UseAnimation = true; DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText, this.BackColor, Color.Yellow, FontManager.GetFont("IRANSans", 9.5f, System.Drawing.FontStyle.Regular) /*Font("IRANSans(FaNum)_Medium", 10f,FontStyle.Regular)*/); newArgs.DrawBackground(); newArgs.DrawBorder(); newArgs.DrawText(TextFormatFlags.TextBoxControl); }
// the boundary box should be set here via ToolTip PopUp event to the measured size of the text to draw private void OnDraw(object sender, DrawToolTipEventArgs e) { //Console.WriteLine( $"OnDraw: {e.Bounds.Width} x {e.Bounds.Height}" ); DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText, this.BackColor, this.ForeColor, ttFont /*new Font ( e.Font, FontStyle.Regular ) */); newArgs.DrawBackground( ); newArgs.DrawBorder( ); newArgs.DrawText(TextFormatFlags.TextBoxControl | TextFormatFlags.VerticalCenter | TextFormatFlags.NoPrefix); }
private void Benimtooltip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); var t = (ToolTip)sender; var h = t.GetType().GetProperty("Handle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); var handle = (IntPtr)h.GetValue(t); var location = new Point(650, 650); var ss = MoveWindow(handle, location.X, location.Y, e.Bounds.Width, e.Bounds.Height, false); }
//private const int Margin = 4; //private void OnPopup(object sender, PopupEventArgs e) //{ // e.ToolTipSize = TextRenderer.MeasureText(GetToolTip(e.AssociatedControl), TooltipFont) + new Size(Margin, Margin); //} private void OnDraw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; e.Graphics.DrawString(e.ToolTipText, TooltipFont, new SolidBrush(ForeColor), e.Bounds, sf); } }
private void toolTip_Draw(object sender, DrawToolTipEventArgs e) { Font f = new Font("Arial", 16.0f); e.DrawBackground(); var symbol = Util.pathSymbolsAlgorithmOutput[comboAlgorithmOutput.SelectedIndex].ToString().Replace("[ID]", (sender as ToolTip).Tag.ToString()); if (File.Exists(symbol)) { e.Graphics.DrawImage(Image.FromFile(symbol), 0, 0); } e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, new PointF(textShift, 15)); }
private void OnDraw(object sender, DrawToolTipEventArgs e) { if (OwnerDraw) { DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText, BackColor, ForeColor, m_font); newArgs.DrawBackground(); newArgs.DrawBorder(); newArgs.DrawText(TextFormatFlags.TextBoxControl); } }
// Handles drawing the ToolTip. private void OnDrawStats(System.Object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); }