Example #1
0
#pragma warning disable 169

		private static void OnUIAPopup (object sender, PopupEventArgs args)
		{
			ToolTip tooltip = (ToolTip) sender;			
			ToolTipProvider provider 
				= (ToolTipProvider) ProviderFactory.GetProvider (tooltip);			
			provider.Show (args.AssociatedControl);
		}
Example #2
0
 private void NotesTip_Popup(object sender, PopupEventArgs e)
 {
     if (OwnerDraw)
     {
         // e.ToolTipSize = new Size(maxWidth + _padding.Horizontal, totalHeight);
     }
 }
Example #3
0
		private void toolTip1_Popup(object sender, PopupEventArgs e)
		{
			toolTip1.SetToolTip(buttonDisplayLabelInfo, "Put into mailing label");
			toolTip1.SetToolTip(buttonClear, "Clear shipping information");
			toolTip1.SetToolTip(buttonPrint, "Print this program");
			toolTip1.SetToolTip(buttonExit, "Exit program");
		}
Example #4
0
 private static void toolTip_Popup(object sender, PopupEventArgs e)
 {
     Size sz = TextRenderer.MeasureText(((ToolTip)sender).GetToolTip(e.AssociatedControl), new Font(tooltipFontFace, tooltipFontSize));
     sz.Height += 4;
     sz.Width += 4;
     e.ToolTipSize = sz;
 }
Example #5
0
 //Fires before the draw event. So set the tooltip size here.
 void RichToolTip_Popup(object sender, PopupEventArgs e)
 {
     using (Graphics g = RtbPCtrl.CreateGraphics())
     {
         toolTipSize = g.MeasureString(RtbPCtrl.Rtf.Trim(), RtbPCtrl.Font).ToSize();
         e.ToolTipSize = toolTipSize;
     }
 }
 private static void OnUIAUnPopup(object sender, SWF.PopupEventArgs args)
 {
     if (provider != null)
     {
         provider.Hide(args.AssociatedControl);
         provider.Terminate();
     }
 }
Example #7
0
		private void MobToolTip_Popup( object sender, PopupEventArgs e ) {
			Size s;
			using( Font f = new Font( "Tahoma", 9 ) )
			using( Image img = new Bitmap( e.ToolTipSize.Width, e.ToolTipSize.Height ) )
			using( Graphics g = Graphics.FromImage( img ) )
				s = DrawMobInfo( g, f, false );

			e.ToolTipSize = new Size( s.Width + 4, s.Height + 4 );
		}
Example #8
0
 private void OnPopup(object sender, PopupEventArgs e)
 {
     var text = this.GetToolTip(e.AssociatedControl);
     var fontsize = e.AssociatedControl.FindForm().Font.Size;
     var font = new Font(SystemFonts.DefaultFont.FontFamily, fontsize);
     e.ToolTipSize = TextRenderer.MeasureText(text, font);
     e.ToolTipSize = new Size(e.ToolTipSize.Width + TOOLTIP_XOFFSET, e.ToolTipSize.Height + TOOLTIP_YOFFSET);
     font.Dispose();
 }
Example #9
0
		public void ColorToolTip_Popup( object sender, PopupEventArgs e ) {
			SizeF s;
			// fake a Draw to get final Size
			using( Image img = new Bitmap( e.ToolTipSize.Width, e.ToolTipSize.Height ) ) {
				using( Graphics g = Graphics.FromImage( img ) ) {
					s = DrawTooltip( g, mDrawFont, false );
				}
			}

			e.ToolTipSize = new Size( (int)s.Width + 4, (int)s.Height + 4 );
		}
Example #10
0
		private void ColorToolTip_Popup(object sender, PopupEventArgs e) {
			// fake a Draw to get final Size

			SizeF finalSize;
			using (Image img = new Bitmap(e.ToolTipSize.Width, e.ToolTipSize.Height)) {
				using (Graphics g = Graphics.FromImage(img)) {
					finalSize = DrawTooltip(g, true);
				}
			}

			e.ToolTipSize = new Size((int)finalSize.Width + TooltipPadding.Right, (int)finalSize.Height + TooltipPadding.Bottom);
		}
Example #11
0
        private static void OnUIAPopup(object sender, SWF.PopupEventArgs args)
        {
            SWF.ErrorProvider error = (SWF.ErrorProvider)sender;

            if (provider != null)
            {
                provider.Terminate();
            }

            //We are doing this because SWF.ErroProvider doesn't use SWF.ToolTip :(
            provider = new ErrorProvider.ErrorProviderToolTipProvider(error);
            provider.Initialize();
            provider.Show(args.AssociatedControl);
        }
Example #12
0
        /// <summary>
        /// Handles popup event from ToolTip control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_toolTip_Popup(object sender, PopupEventArgs e)
        {
            // If height of tooltip differs from the previous one, then we 
            // must store it and do not show tooltip at wrong position
            if (!m_size.Equals(e.ToolTipSize))
            {
                m_size = e.ToolTipSize;
                e.Cancel = true;
                m_canceled = true;
                m_text = String.Empty;
                return;
            }

            m_canceled = false;
        }
Example #13
0
        void HtmlToolTip_Popup(object sender, PopupEventArgs e)
        {
            string text = this.GetToolTip(e.AssociatedControl);
            string font = string.Format(NumberFormatInfo.InvariantInfo, "font: {0}pt {1}", e.AssociatedControl.Font.Size, e.AssociatedControl.Font.FontFamily.Name);

            //Create fragment container
            container = new InitialContainer("<table class=htmltooltipbackground cellspacing=5 cellpadding=0 style=\"" + font + "\"><tr><td style=border:0px>" + text + "</td></tr></table>");
            container.SetBounds(new Rectangle(0, 0, 10, 10));
            container.AvoidGeometryAntialias = true;

            //Measure bounds of the container
            using (Graphics g = e.AssociatedControl.CreateGraphics())
            {
                container.MeasureBounds(g);
            }

            //Set the size of the tooltip
            e.ToolTipSize = Size.Round(container.MaximumSize);
        }
Example #14
0
 private void PermanentToolTip_Popup(object sender, PopupEventArgs e)
 {
     timer.Start();
 }
Example #15
0
        private void variableHover_Popup(object sender, PopupEventArgs e)
        {
            using (Font fw = new Font(FontFamily.GenericMonospace, ToolTipFontSize))
            {
                SizeF size = TextRenderer.MeasureText(m_HoverText, fw);

                e.ToolTipSize = new Size((int)size.Width, (int)size.Height);
            }
        }
Example #16
0
 /// <summary>
 /// Wywoływana, gdy pojawia się podpowiedź zawierająca tekst filtra. Dostosowywuje rozmiar podpowiedzi.
 /// </summary>
 /// <param name="sender">Podpowiedź wyświetlająca tekst filtra.</param>
 /// <param name="e">Argumenty zdarzenia.</param>
 void filterTip_Popup(object sender, PopupEventArgs e)
 {
     e.ToolTipSize = comboBox.Size;
 }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handles the popup.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		void HandlePopup(object sender, PopupEventArgs e)
		{
			using (Graphics g = Graphics.FromHwnd(e.AssociatedWindow.Handle))
			{
				Size sz1 = TextRenderer.MeasureText(g, ToolTipTitle, m_fntTitle);
				Size sz2 = TextRenderer.MeasureText(g, m_text, m_fntText);

				m_rcTitle = new Rectangle(10, 10, sz1.Width, sz1.Height);
				m_rcText = new Rectangle(10, m_rcTitle.Bottom + 15, sz2.Width, sz2.Height);

				if (m_showMissingGlyphIcon)
				{
					m_rcTitle.X += (m_missingGlyphIcon.Width + 5);
					sz1.Width += (m_missingGlyphIcon.Width + 5);
					sz1.Height = Math.Max(sz1.Height, m_missingGlyphIcon.Height);
				}

				sz1.Width = Math.Max(sz1.Width, sz2.Width) + 20;
				sz1.Height += (sz2.Height + 35);
				e.ToolTipSize = sz1;
			}
		}
		private void ToolTip_Popup(object sender, PopupEventArgs e) {
			using (Graphics g = Graphics.FromHwnd(Handle)) {
				int width = (int) Math.Ceiling(g.MeasureString(_cell.Description, _font).Width) + 1;
				e.ToolTipSize = new Size(Math.Max(width, _cell.Width), RowHeight);
			}
		}
Example #19
0
        private void MetroToolTip_Popup(object sender, PopupEventArgs e)
        {
            if (e.AssociatedWindow is IMetroForm)
            {
                Style = ((IMetroForm)e.AssociatedWindow).Style;
                Theme = ((IMetroForm)e.AssociatedWindow).Theme;
                StyleManager = ((IMetroForm)e.AssociatedWindow).StyleManager;
            }
            else if (e.AssociatedControl is IMetroControl)
            {
                Style = ((IMetroControl)e.AssociatedControl).Style;
                Theme = ((IMetroControl)e.AssociatedControl).Theme;
                StyleManager = ((IMetroControl)e.AssociatedControl).StyleManager;
            }

            e.ToolTipSize = new Size(e.ToolTipSize.Width + 24, e.ToolTipSize.Height + 9);
        }
Example #20
0
 public RibbonElementPopupEventArgs(IRibbonElement item, PopupEventArgs args)
     : base(args.AssociatedWindow, args.AssociatedControl, args.IsBalloon, args.ToolTipSize)
 {
     AssociatedRibbonElement = item;
     _args = args;
 }
Example #21
0
 /// <summary>
 /// The on popup.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void OnPopup(object sender, PopupEventArgs e)
 {
     var text = this.GetToolTip(e.AssociatedControl);
     var ttSize = this.GetSize(text);
     e.ToolTipSize = ttSize;
 }
Example #22
0
        /// <summary>
        ///		Trata el evento PopUp del toolTip
        /// </summary>
        private void ToolTipExtend_Popup(Object sender, System.Windows.Forms.PopupEventArgs e) // Handles Me.Popup
        {                                                                                      // Si OwnerDraw es verdadero y el texto de la propiedad ToolTipExtendText no esta vacía
            if (IsToolTipExtend && OwnerDraw && IsAssignedControl(e.AssociatedControl))
            {
                bool hayTitulo = false, hayIcono = false, hayTexto = false, hayImagen = false, hayPie = false;

                // Calcular el tamaño del ToolTipExtend
                // Obtener el tamaño individual de los elementos
                Size tamTitulo = new Size(0, 0), tamTexto = new Size(0, 0), tamPie = new Size(0, 0);
                Size tamImagen = new Size(0, 0), tamIcono = new Size(0, 0);
                int  tamTabSeccion2 = cnstIntWidthSeparator;

                if (!string.IsNullOrEmpty(GetTitle(e.AssociatedControl)))
                {
                    tamTitulo = TextRenderer.MeasureText(GetTitle(e.AssociatedControl), arrObjSection[(int)enumSection.SectionTitle].FontText);
                    hayTitulo = true;
                }

                Image icono;
                icono = GetIcon(e.AssociatedControl);
                if (icono != null)
                {
                    tamIcono = icono.Size;
                    hayIcono = true;
                }
                tamTexto = TextRenderer.MeasureText(GetToolTip(e.AssociatedControl),
                                                    arrObjSection[(int)enumSection.SectionText].FontText);
                hayTexto = true;

                Image imagen;
                imagen = GetImage(e.AssociatedControl);
                if (imagen != null)
                {
                    tamImagen = imagen.Size;
                    hayImagen = true;
                }
                if (!string.IsNullOrEmpty(GetFooter(e.AssociatedControl)))
                {
                    tamPie = TextRenderer.MeasureText(GetFooter(e.AssociatedControl), arrObjSection[(int)enumSection.SectionFoot].FontText);
                    hayPie = true;
                }
                if (hayTitulo || hayPie)
                {
                    tamTabSeccion2 = cnstIntWidthSeparator + cnstIntWidthSeparator;
                }

                // Calcular altura del ToolTipExtend
                szToolTip.Height = cnstIntWidthSeparator;
                // Calcular altura del ToolTipExtend - Sección 1
                if (hayTitulo || hayIcono)
                {
                    if (tamTitulo.Height >= tamIcono.Height)
                    {
                        szToolTip.Height += tamTitulo.Height + cnstIntWidthSeparator;
                    }
                    else
                    {
                        szToolTip.Height += tamIcono.Height + cnstIntWidthSeparator;
                    }
                }
                // Calcular altura del ToolTipExtend - Sección 2
                if (hayTexto && hayImagen)
                {                                            // Identificar la orientación de la imagen
                    if (tamImagen.Height >= tamImagen.Width) // Orientación vertical
                    {
                        if (tamImagen.Height >= tamTexto.Height)
                        {
                            szToolTip.Height += tamImagen.Height + cnstIntWidthSeparator;
                        }
                        else
                        {
                            szToolTip.Height += tamTexto.Height + cnstIntWidthSeparator;
                        }
                    }
                    else // Orientación horizontal
                    {
                        szToolTip.Height += tamImagen.Height + cnstIntWidthSeparator + tamTexto.Height + cnstIntWidthSeparator;
                    }
                }
                else if (hayTexto)
                {
                    szToolTip.Height += tamTexto.Height + cnstIntWidthSeparator;
                }
                else
                {
                    szToolTip.Height += tamImagen.Height + cnstIntWidthSeparator;
                }

                // Calcular altura del ToolTipExtend - Sección 3
                if (hayPie)
                {
                    szToolTip.Height += tamPie.Height + cnstIntWidthSeparator;
                }
                // Calcular ancho del ToolTipExtend
                int anchoSeccion1 = 0, anchoSeccion2 = 0, anchoSeccion3 = 0;
                // Calcular ancho del ToolTipExtend - Sección 1
                if (hayTitulo && hayIcono)
                {
                    anchoSeccion1 = cnstIntWidthSeparator + tamTitulo.Width + tamIcono.Width + cnstIntWidthSeparator;
                }
                else if (hayTitulo)
                {
                    anchoSeccion1 = cnstIntWidthSeparator + tamTitulo.Width + cnstIntWidthSeparator;
                }
                else
                {
                    anchoSeccion1 = cnstIntWidthSeparator + tamIcono.Width + cnstIntWidthSeparator;
                }
                // Calcular ancho del ToolTipExtend - Sección 2
                if (hayTexto && hayImagen)
                {                                            // Identificar la orientación de la imagen
                    if (tamImagen.Height >= tamImagen.Width) // Orientación vertical
                    {
                        anchoSeccion2 = tamTabSeccion2 + tamImagen.Width + cnstIntWidthSeparator + tamTexto.Width + cnstIntWidthSeparator;
                    }
                    else                                // Orientación horizontal
                    {
                        if (tamImagen.Width >= tamTexto.Width)
                        {
                            anchoSeccion2 = tamTabSeccion2 + tamImagen.Width + cnstIntWidthSeparator;
                        }
                        else
                        {
                            anchoSeccion2 = tamTabSeccion2 + tamTexto.Width + cnstIntWidthSeparator;
                        }
                    }
                }
                else if (hayTexto)
                {
                    anchoSeccion2 = tamTabSeccion2 + tamTexto.Width + cnstIntWidthSeparator;
                }
                else
                {
                    anchoSeccion2 = tamTabSeccion2 + tamImagen.Width + cnstIntWidthSeparator;
                }
                // Calcular ancho del ToolTipExtend - Seccion 3
                if (hayPie)
                {
                    anchoSeccion3 = cnstIntWidthSeparator + tamPie.Width + cnstIntWidthSeparator;
                }
                // El ancho del ToolTipExtend depende de la sección mas ancha
                if (anchoSeccion1 >= anchoSeccion2 && anchoSeccion1 >= anchoSeccion3)
                {
                    szToolTip.Width = anchoSeccion1;
                }
                else if (anchoSeccion2 >= anchoSeccion1 && anchoSeccion2 >= anchoSeccion3)
                {
                    szToolTip.Width = anchoSeccion2;
                }
                else
                {
                    szToolTip.Width = anchoSeccion3;
                }
                // Calcular las posiciones de los elementos del ToolTipExtend
                Point inicioSeccion1 = new Point(cnstIntWidthSeparator, cnstIntWidthSeparator);
                Point inicioSeccion2 = new Point(tamTabSeccion2, cnstIntWidthSeparator);
                Point inicioSeccion3;

                // Calcular las posiciones de los elementos - Sección 1
                if (hayTitulo || hayIcono)
                {
                    if (tamTitulo.Height >= tamIcono.Height)
                    {
                        arrObjSection[(int)enumSection.SectionTitle].Position = inicioSeccion1;
                        arrObjSection[(int)enumSection.SectionIcon].Position  = new Point(szToolTip.Width - cnstIntWidthSeparator - tamIcono.Width, arrObjSection[(int)enumSection.SectionTitle].Position.Y + tamTitulo.Height / 2 - tamIcono.Height / 2);
                        inicioSeccion2 = new Point(tamTabSeccion2, arrObjSection[(int)enumSection.SectionTitle].Position.Y + tamTitulo.Height + cnstIntWidthSeparator);
                    }
                    else
                    {
                        arrObjSection[(int)enumSection.SectionIcon].Position  = new Point(szToolTip.Width - cnstIntWidthSeparator - tamIcono.Width, inicioSeccion1.Y);
                        arrObjSection[(int)enumSection.SectionTitle].Position = new Point(inicioSeccion1.X, arrObjSection[(int)enumSection.SectionIcon].Position.Y + tamIcono.Height / 2 - tamTitulo.Height / 2);
                        inicioSeccion2 = new Point(tamTabSeccion2, arrObjSection[(int)enumSection.SectionIcon].Position.Y + tamIcono.Height + cnstIntWidthSeparator);
                    }
                }

                // Calcular las posiciones de los elementos - Sección 2
                if (hayTexto && hayImagen)
                {
                    if (tamImagen.Height >= tamImagen.Width) // Orientación vertical
                    {
                        arrObjSection[(int)enumSection.SectionImage].Position = inicioSeccion2;
                        arrObjSection[(int)enumSection.SectionText].Position  = new Point(arrObjSection[(int)enumSection.SectionImage].Position.X + tamImagen.Width + cnstIntWidthSeparator, arrObjSection[(int)enumSection.SectionImage].Position.Y);
                        if (tamImagen.Height >= tamTexto.Height)
                        {
                            inicioSeccion3 = new Point(cnstIntWidthSeparator, arrObjSection[(int)enumSection.SectionImage].Position.Y + tamImagen.Height + cnstIntWidthSeparator);
                        }
                        else
                        {
                            inicioSeccion3 = new Point(cnstIntWidthSeparator, arrObjSection[(int)enumSection.SectionText].Position.Y + tamTexto.Height + cnstIntWidthSeparator);
                        }
                    }
                    else // Orientación horizontal
                    {
                        if (tamImagen.Width >= tamTexto.Width)
                        {
                            arrObjSection[(int)enumSection.SectionImage].Position = inicioSeccion2;
                            arrObjSection[(int)enumSection.SectionText].Position  = new Point(arrObjSection[(int)enumSection.SectionImage].Position.X, arrObjSection[(int)enumSection.SectionImage].Position.Y + tamImagen.Height + cnstIntWidthSeparator);
                        }
                        else
                        {
                            arrObjSection[(int)enumSection.SectionText].Position  = new Point(inicioSeccion2.X, inicioSeccion2.Y + tamImagen.Height + cnstIntWidthSeparator);
                            arrObjSection[(int)enumSection.SectionImage].Position = new Point(arrObjSection[(int)enumSection.SectionText].Position.X + tamTexto.Width / 2 - tamImagen.Width / 2, inicioSeccion2.Y);
                        }
                        inicioSeccion3 = new Point(cnstIntWidthSeparator, arrObjSection[(int)enumSection.SectionText].Position.Y + tamTexto.Height + cnstIntWidthSeparator);
                    }
                }
                else if (hayTexto)
                {
                    arrObjSection[(int)enumSection.SectionText].Position = inicioSeccion2;
                    inicioSeccion3 = new Point(cnstIntWidthSeparator, arrObjSection[(int)enumSection.SectionText].Position.Y + tamTexto.Height + cnstIntWidthSeparator);
                }
                else
                {
                    arrObjSection[(int)enumSection.SectionImage].Position = inicioSeccion2;
                    inicioSeccion3 = new Point(cnstIntWidthSeparator, arrObjSection[(int)enumSection.SectionImage].Position.Y + tamImagen.Height + cnstIntWidthSeparator);
                }

                // Calcular las posiciones de los elementos - Sección 3
                if (hayPie)
                {
                    intPositionLine   = inicioSeccion3.Y - cnstIntWidthSeparator / 2;
                    inicioSeccion3.Y += 1;
                    arrObjSection[(int)enumSection.SectionFoot].Position = inicioSeccion3;
                }
                e.ToolTipSize = szToolTip;
            }
            else if (IsToolTipExtend && !IsAssignedControl(e.AssociatedControl))
            {
                e.Cancel = true;
            }
        }
        /// <summary>
        /// CustomizedToolTip_Popup raised when tooltip pops up.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        void ToolTip_Popup(object sender, PopupEventArgs e)
        {
            if (this.Popup != null)
            {
                this.Popup(sender, e);
                if (e.Cancel)  // it cancel return ASAP
                    return;
            }

            //here we measure the size requirements of the tooltip
            try
            {
                if (OwnerDraw)
                {
                    if (!_AutoSize)
                    {
                        //manually determine the tip size based on the visible components
                        Graphics g = e.AssociatedControl.CreateGraphics();
                        Size sSize;

                        int CurLeft = TipPadding.Left;
                        int CurTop = TipPadding.Top;

                        if (!string.IsNullOrEmpty(base.ToolTipTitle))
                        {
                            Font fTitle = new Font(_Font, FontStyle.Bold);
                            sSize = g.MeasureString(base.ToolTipTitle, fTitle, DEFAULT_WIDTH).ToSize();
                            sSize.Width = Math.Max(sSize.Width + 5, DEFAULT_WIDTH);
                            _TitleRectangle = new Rectangle(CurLeft, CurTop, sSize.Width, sSize.Height);
                            //_TitleRectangle = Rectangle.FromLTRB(CurLeft, CurTop, sSize.Width + CurLeft, CurTop + sSize.Height);
                            CurTop = _TitleRectangle.Bottom + 5;
                            fTitle.Dispose();
                        }

                        if (_ToolTipImage != null)
                        {
                            _ImageRectangle = new Rectangle(CurLeft, CurTop, _ToolTipImage.Width + 2, _ToolTipImage.Height + 2);

                            CurLeft = _ImageRectangle.Right + 10;
                        }
                        else if (!string.IsNullOrEmpty(base.ToolTipTitle))
                        {
                            CurLeft += 15; //indent the text from the title
                        }

                        sSize = g.MeasureString(base.GetToolTip(e.AssociatedControl), _Font, DEFAULT_WIDTH).ToSize();
                        _TextRectangle = Rectangle.FromLTRB(CurLeft, CurTop, sSize.Width + CurLeft + 4, CurTop + sSize.Height);
                        CurLeft = _TextRectangle.Right;

                        //now calculate the total size of the tooltip and set the size
                        Size TSize = new Size(Math.Max(_TextRectangle.Right, _TitleRectangle.Right) + TipPadding.Right, Math.Max(_TextRectangle.Bottom, _ImageRectangle.Bottom) + TipPadding.Bottom);
                        e.ToolTipSize = TSize;
                    }
                    else
                    {
                        Size oldSize = e.ToolTipSize;
                        Control parent = e.AssociatedControl;
                        Image toolTipImage = parent.Tag as Image;
                        if (toolTipImage != null)
                        {
                            _ImageWidth = oldSize.Height;
                            oldSize.Width += _ImageWidth + TipPadding.Left;
                        }
                        else
                        {
                            oldSize.Width += TipPadding.Left;
                        }
                        e.ToolTipSize = oldSize;
                    }
                }
            }
            catch (Exception ex)
            {
                string logMessage = "Exception in RibbonToolTip_Popup (object, PopupEventArgs) " + ex.ToString();
                Trace.TraceError(logMessage);
                throw;
            }
        }
Example #24
0
        /// <summary>
        /// CustomizedToolTip_Popup raised when tooltip pops up.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        void ToolTip_Popup(object sender, PopupEventArgs e)
        {
            //here we measure the size requirements of the tooltip
            try
            {
                if (OwnerDraw)
                {
                    if (!_AutoSize)
                    {
                        //manually determine the tip size based on the visible components
                        Graphics g = e.AssociatedControl.CreateGraphics();
                        Size     sSize;

                        int CurLeft = TipPadding.Left;
                        int CurTop  = TipPadding.Top;

                        if (base.ToolTipTitle != string.Empty)
                        {
                            Font fTitle = new Font(_Font, FontStyle.Bold);
                            sSize           = g.MeasureString(base.ToolTipTitle, fTitle, DEFAULT_WIDTH).ToSize();
                            sSize.Width     = Math.Max(sSize.Width + 5, DEFAULT_WIDTH);
                            _TitleRectangle = new Rectangle(CurLeft, CurTop, sSize.Width, sSize.Height);
                            //_TitleRectangle = Rectangle.FromLTRB(CurLeft, CurTop, sSize.Width + CurLeft, CurTop + sSize.Height);
                            CurTop = _TitleRectangle.Bottom + 5;
                            fTitle.Dispose();
                        }

                        if (_ToolTipImage != null)
                        {
                            _ImageRectangle = new Rectangle(CurLeft, CurTop, _ToolTipImage.Width + 2, _ToolTipImage.Height + 2);

                            CurLeft = _ImageRectangle.Right + 10;
                        }
                        else
                        {
                            CurLeft += 15;                             //indent the text from the title
                        }

                        sSize          = g.MeasureString(base.GetToolTip(e.AssociatedControl), _Font, DEFAULT_WIDTH).ToSize();
                        _TextRectangle = Rectangle.FromLTRB(CurLeft, CurTop, sSize.Width + CurLeft + 4, CurTop + sSize.Height);
                        CurLeft        = _TextRectangle.Right;

                        //now calculate the total size of the tooltip and set the size
                        Size TSize = new Size(Math.Max(_TextRectangle.Right, _TitleRectangle.Right) + TipPadding.Right, Math.Max(_TextRectangle.Bottom, _ImageRectangle.Bottom) + TipPadding.Bottom);
                        e.ToolTipSize = TSize;
                    }
                    else
                    {
                        Size    oldSize      = e.ToolTipSize;
                        Control parent       = e.AssociatedControl;
                        Image   toolTipImage = parent.Tag as Image;
                        if (toolTipImage != null)
                        {
                            _ImageWidth    = oldSize.Height;
                            oldSize.Width += _ImageWidth + TipPadding.Left;
                        }
                        else
                        {
                            oldSize.Width += TipPadding.Left;
                        }
                        e.ToolTipSize = oldSize;
                    }
                }
            }
            catch (Exception ex)
            {
                string logMessage = "Exception in RibbonToolTip_Popup (object, PopupEventArgs) " + ex.ToString();
                Trace.TraceError(logMessage);
                throw;
            }
        }
Example #25
0
        /// <summary>
        /// On tooltip appear set the html by the associated control, layout and set the tooltip size by the html size.
        /// </summary>
        protected virtual void OnToolTipPopup(PopupEventArgs e)
        {
            //Create fragment container
            HtmlContainer.SetHtml(YamuiThemeManager.WrapToolTipText(GetToolTip(e.AssociatedControl)), YamuiThemeManager.CurrentThemeCss);
            HtmlContainer.MaxSize = MaximumSize;

            //Measure size of the container
            using (var g = e.AssociatedControl.CreateGraphics()) {
                g.TextRenderingHint = _textRenderingHint;
                HtmlContainer.PerformLayout(g);
            }

            //Set the size of the tooltip
            var desiredWidth = (int)Math.Ceiling(MaximumSize.Width > 0 ? Math.Min(HtmlContainer.ActualSize.Width, MaximumSize.Width) : HtmlContainer.ActualSize.Width);
            var desiredHeight = (int)Math.Ceiling(MaximumSize.Height > 0 ? Math.Min(HtmlContainer.ActualSize.Height, MaximumSize.Height) : HtmlContainer.ActualSize.Height);
            e.ToolTipSize = new Size(desiredWidth, desiredHeight);

            #if !MONO
            // start mouse handle timer
            if (_allowLinksHandling) {
                _associatedControl = e.AssociatedControl;
                _linkHandlingTimer.Start();
            }
            #endif
        }
 public RibbonElementPopupEventArgs(IRibbonElement item, PopupEventArgs args)
     : base(args.AssociatedWindow, args.AssociatedControl, args.IsBalloon, args.ToolTipSize)
 {
     this._ribbonElement = item;
     this._args = args;
 }
Example #27
0
 private void tooltip_window_Popup(object sender, PopupEventArgs e)
 {
     e.ToolTipSize = ThemeEngine.Current.ToolTipSize(tooltip_window, tooltip_window.Text);
     OnPopup(e);
 }
Example #28
0
 private void changeButtonToolTip_Popup(object sender, PopupEventArgs e)
 {
     // on popip set the size of tool tip
     e.ToolTipSize = TextRenderer.MeasureText(changeButtonText, changeButtonFont);
 }
Example #29
0
        /// <summary>
        /// Set the size of the tooltip's area
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">PopupEventArgs</param>
        private void toolTipSLMIV_Popup(object sender, PopupEventArgs e)
        {
            int wid = e.ToolTipSize.Width + 150;
            int hgt = e.ToolTipSize.Height;
            if (hgt < 150)
                hgt = 150;

            e.ToolTipSize = new Size(wid, hgt);
        }
Example #30
0
 private void disassemblerTip_Popup(object sender, PopupEventArgs e)
 {
 }
Example #31
0
        private void OnPopup(object sender, PopupEventArgs e)
        {

            //MessageBox.Show(RichTextBoxToolTip.TitlePrefix);
            if (!AutoSize)
            {
                e.ToolTipSize = Size;
            }
            else
            {
                var r = new Bitmap(e.ToolTipSize.Width, e.ToolTipSize.Height);
                var g = Graphics.FromImage(r);
                r.Dispose();
                var szT = g.MeasureString(Prefix + this.ToolTipTitle + Suffix, this.TitleFont);
                var szD = g.MeasureString(this.ToolTipDescription, this.DescriptionFont);

                MinWidth = (int)szT.Width + 10;
                if (szT.Width > szD.Width)
                {
                    // Set tooltip's size according to the Title text property
                    if (String.IsNullOrEmpty(ToolTipDescription))
                    {
                        // Set tooltip size without respecting the description's size
                        e.ToolTipSize = new Size((int)szT.Width + 10, (int)(szT.Height) + 10);
                    }
                    else
                    {
                        // Set tooltip size by taking into account the description's size
                        var w = szT.Width;
                        if (w < szD.Width) { w = szD.Width; };
                        var h = szT.Height + szD.Height;
                        e.ToolTipSize = new Size((int)w + 10, (int)h + 20);
                    };
                }
                else
                {
                    if (MaxWidth != 0)
                    {
                        var ex = g.MeasureString(this.ToolTipDescription, this.DescriptionFont, MaxWidth);
                        int mVal = MaxWidth;
                        if (mVal == 0) mVal = 1;
                        int w = ((int)ex.Width) + 10;
                        int h = (int)(ex.Height);
                        int wrappedLines = w / mVal;
                        if (wrappedLines == 0) wrappedLines = 1;
                        w /= wrappedLines;
                        h *= wrappedLines;
                        if (w < MinWidth)
                        {
                            e.ToolTipSize = new Size(MinWidth, (int)(h + szT.Height) + (TitleFont.Height + 10));
                        }
                        else
                        {
                            e.ToolTipSize = new Size(w + 10, h + (int)szT.Height + (TitleFont.Height + 10));
                        };
                    }
                    else
                    {
                        int w = ((int)szD.Width) + 10;
                        int h = (int)(szD.Height);
                        tSize = new Size(w + 10, h + (int)szT.Height);
                        tSize.Height += (TitleFont.Height + 10);
                        e.ToolTipSize = tSize;
                    };
                };

            };
        }
Example #32
0
 public void ToolTip1_Popup(System.Object sender, System.Windows.Forms.PopupEventArgs e)
 {
 }
Example #33
0
 private void iterationsToolTip_Popup(object sender, System.Windows.Forms.PopupEventArgs e)
 {
     e.ToolTipSize = TextRenderer.MeasureText(iterationsTrackBar.Value.ToString(), new Font("Arial", 16.0f));
 }
Example #34
0
 private void EnhancedToolTip_Popup(object sender, PopupEventArgs e)
 {
     if (e.AssociatedControl is BetterTooltipTransparentOverlay)
     {
         base.ToolTipTitle = String.Empty;
         base.ToolTipIcon = ToolTipIcon.None;
     }
     else
     {
         base.ToolTipTitle = _toolTipTitle;
         base.ToolTipIcon = _toolTipIcon;
     }
 }
 private void myToolTip_Popup(object sender, PopupEventArgs e)
 {
 }
Example #36
0
 private void OnToolTipPopup(object sender, PopupEventArgs e)
 {
     OnToolTipPopup(e);
 }
Example #37
0
        void tip_Popup_Fore(object sender, PopupEventArgs e)
        {
            ToolTip tt = sender as ToolTip;
            if (tt == null)
                return;
            string title = null;
            MDIChild mc = this.ActiveMdiChild as MDIChild;
            if (mc != null && mc.DesignTab == "design" && mc.DrawCtl.SelectedCount == 1)
            {
                title = foreColorPicker1.Text;
            }

            tt.ToolTipTitle = title;
        }
Example #38
0
 private void toolTip1_Popup(object sender, PopupEventArgs e)
 {
 }
Example #39
0
 void ToolTip_Popup(object sender, System.Windows.Forms.PopupEventArgs e)
 {
     e.ToolTipSize = _tipInfo.Size;
 }