Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. ToolTip on GDI+ figure

ToolTip on GDI+ figure

Scheduled Pinned Locked Moved C#
graphicswinformsquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r9
    wrote on last edited by
    #1

    It is possible to put a tooltip on a GDI+ figure? (on mouseOver) The tooltip1.SetToolTip() method takes in a System.WindowsForms.Control, but there is no overload for a GDI drawing ?

    V 1 Reply Last reply
    0
    • R r9

      It is possible to put a tooltip on a GDI+ figure? (on mouseOver) The tooltip1.SetToolTip() method takes in a System.WindowsForms.Control, but there is no overload for a GDI drawing ?

      V Offline
      V Offline
      Valeria Bogdevich
      wrote on last edited by
      #2

      1). Declare global variables ToolTip tt; and bool installed = true; 2). Initialize tt in constructor of the form: tt = new ToolTip() 3). Override OnMouseMove:

      protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
      {
      if (bounds.Contains(e.X, e.Y))
      {
      this.Cursor = Cursors.Hand;
      if (installed)
      {
      tt.SetToolTip(this, "Hello, r9 :o)");
      installed = false;
      }
      }
      else
      {
      this.Cursor = Cursors.Default;
      if (!installed)
      {
      tt.RemoveAll();
      installed = true;
      }
      }
      base.OnMouseEnter(e);
      }


      "...hasn't really been well accepted ... as the ratings tell us so far :)" - Nishant S

      R 1 Reply Last reply
      0
      • V Valeria Bogdevich

        1). Declare global variables ToolTip tt; and bool installed = true; 2). Initialize tt in constructor of the form: tt = new ToolTip() 3). Override OnMouseMove:

        protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
        if (bounds.Contains(e.X, e.Y))
        {
        this.Cursor = Cursors.Hand;
        if (installed)
        {
        tt.SetToolTip(this, "Hello, r9 :o)");
        installed = false;
        }
        }
        else
        {
        this.Cursor = Cursors.Default;
        if (!installed)
        {
        tt.RemoveAll();
        installed = true;
        }
        }
        base.OnMouseEnter(e);
        }


        "...hasn't really been well accepted ... as the ratings tell us so far :)" - Nishant S

        R Offline
        R Offline
        r9
        wrote on last edited by
        #3

        You are genius :-) With all your help, I am getting better and better at understanding GDI+. Thanks

        V 1 Reply Last reply
        0
        • R r9

          You are genius :-) With all your help, I am getting better and better at understanding GDI+. Thanks

          V Offline
          V Offline
          Valeria Bogdevich
          wrote on last edited by
          #4

          Do you code a control or you just draw shape on the form? All code examples supposed to work for the shape drawn on the form. If you want to use examples to code a control, you should make some changes (some lines are not necessary and some things should be coded in other way).


          "...hasn't really been well accepted ... as the ratings tell us so far :)" - Nishant S

          R 1 Reply Last reply
          0
          • V Valeria Bogdevich

            Do you code a control or you just draw shape on the form? All code examples supposed to work for the shape drawn on the form. If you want to use examples to code a control, you should make some changes (some lines are not necessary and some things should be coded in other way).


            "...hasn't really been well accepted ... as the ratings tell us so far :)" - Nishant S

            R Offline
            R Offline
            r9
            wrote on last edited by
            #5

            I have a pictureBox on my Form. Then I use the graphics object from the PictureBox_paint event: .. graphicsObj = e.Graphics; ..

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups