private void Tooltip_Draw(object sender, DrawToolTipEventArgs e) { using (bm = new QuickBitmap(e.Bounds.Size)) { e.Graphics.Clear(this._tooltip.BackColor); ee = new DrawToolTipEventArgs(bm.Graphics, e.AssociatedWindow, e.AssociatedControl, new Rectangle(0, 0, e.Bounds.Width, e.Bounds.Height), e.ToolTipText, this._tooltip.BackColor, this._tooltip.ForeColor, this._tooltip.Font); ee.Graphics.Clear(Color.Transparent); ee.DrawBorder(); //e.Graphics.CopyFromScreen(new Point(e.Bounds.X + MousePosition.X, e.Bounds.Y + MousePosition.Y), Point.Empty, e.Bounds.Size, CopyPixelOperation.SourceCopy); ee.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; ee.Bounds.Offset(2, 2); ee.Bounds.Inflate(-4, -4); PSO2Plugin _plug = ee.AssociatedControl.Tag as PSO2Plugin; if (_plug != null && !_plug.Managed) { var _stringSize = _plug.GetToolTip(true, this._tooltip.Font, this._tooltip.PreferedSize.Width, TextFormatFlags.Left); Rectangle rect = new Rectangle(ee.Bounds.X, ee.Bounds.Y, _stringSize.Size.Width, _stringSize.Size.Height); TextRenderer.DrawText(ee.Graphics, _stringSize.Result, this._tooltip.Font, rect, this._tooltip.ForeColor, this._tooltip.BackColor, TextFormatFlags.Left); using (Font f = new Font(this._tooltip.Font.FontFamily, this._tooltip.Font.Size, FontStyle.Bold)) { _stringSize = TextRendererWrapper.WrapString(_plug.GetWarningMessage(), this._tooltip.PreferedSize.Width, f, TextFormatFlags.Left); TextRenderer.DrawText(ee.Graphics, _stringSize.Result, f, new Rectangle(ee.Bounds.X, ee.Bounds.Y + rect.Height, _stringSize.Size.Width, _stringSize.Size.Height), Color.Red, this._tooltip.BackColor, TextFormatFlags.Left); } } else { TextRenderer.DrawText(ee.Graphics, ee.ToolTipText, this._tooltip.Font, ee.Bounds, Color.FromArgb(255, 255, 255), Color.FromArgb(17, 17, 17), TextFormatFlags.Left); } e.Graphics.DrawImage(bm.Bitmap, e.Bounds, ee.Bounds, GraphicsUnit.Pixel); } }
private void Tooltip_Popup(object sender, PopupEventArgs e) { PSO2Plugin _plug = e.AssociatedControl.Tag as PSO2Plugin; if (_plug != null) { if (!_plug.Managed) { var _stringSize = _plug.GetToolTip(true, this._tooltip.Font, this._tooltip.PreferedSize.Width, TextFormatFlags.Left); Rectangle rect1 = new Rectangle(0, 0, _stringSize.Size.Width, _stringSize.Size.Height); using (Font f = new Font(this._tooltip.Font.FontFamily, this._tooltip.Font.Size, FontStyle.Bold)) { _stringSize = TextRendererWrapper.WrapString(_plug.GetWarningMessage(), this._tooltip.PreferedSize.Width, f, TextFormatFlags.Left); e.ToolTipSize = new Size(Math.Max(rect1.Width, _stringSize.Size.Width) + 4, rect1.Height + _stringSize.Size.Height + 4); } } else { var _stringSize = _plug.GetToolTip(true, this._tooltip.Font, this._tooltip.PreferedSize.Width, TextFormatFlags.Left); e.ToolTipSize = new Size(_stringSize.Size.Width + 4, _stringSize.Size.Height + 4); } } }
private CheckBox CreateCheckBoxButton(PSO2Plugin _Plugin, string _PluginName) { CheckBox cButton = new CheckBox(); cButton.Text = _PluginName; cButton.Tag = _Plugin; if (!_Plugin.Managed) { cButton.ForeColor = System.Drawing.Color.Red; } cButton.AutoCheck = false; cButton.AutoSize = true; cButton.Checked = _Plugin.Enabled; cButton.Padding = new Padding(1); cButton.Click += CButton_Click; this._tooltip.SetToolTip(cButton, _Plugin.GetToolTip(this._tooltip.Font, this._tooltip.PreferedSize.Width, TextFormatFlags.Left).Result); this.innerDict.Add(_Plugin, cButton); return(cButton); }