Results 1 to 21 of 21

Thread: [2005] Tooltip with image

  1. #1

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    [2005] Tooltip with image

    Is it possible to show a System.Drawing.Image inside a ToolTip?

    thanks in advance
    Home is where your Head is

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Tooltip with image

    Not as is. You'd have to inherit the ToolTip class and add the functionality yourself. It may require API calls to access the Win32 object underneath or you may be able to just use GDI+.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Tooltip with image

    JM, I think this be done with OwnerDraw set?

    This requires a sub to draw the tooltip (using GDI+). I have only ever used this method to show a tooltip with text in different colors. But since the tooltip draw event has a drawing surface, I think any graphics object should be permissible?

    I don't have access to my apps code at present, but I made my custom tooltip based on the example at...

    http://msdn2.microsoft.com/en-us/lib...ownerdraw.aspx

    Edit: I just ran up the example and including an e.Graphics.DrawImage in the draw event and does display an image.
    Last edited by Bulldog; Mar 17th, 2007 at 07:37 PM.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Tooltip with image

    Should have looked at the doco since 2003 shouldn't I.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Tooltip with image

    Hey, no problem. It's not very often I get to educate a guru!

    Actually in your signature, you used to have a link to some free controls, I seem to remember that one of those was an enhanced tooltip that may be easier for dani2 to work with. Do you have the link for that? I've forgotten the vendors name, but they were in Aus. (It was a name something like Quantas).

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Tooltip with image

    Those components were for .NET 1.1 and simply provided access to features of the underlying Win32 component that Microsoft have now added to .NET 2.0. Having looked at the doco I don't see it getting much easier than setting OwnerDraw to True and handling the Draw event.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: [2005] Tooltip with image [RESOLVED]

    thanks guys.

    e.Graphics.DrawImage did the trick
    Home is where your Head is

  8. #8
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    Can you post example of code ?

    Thanks in advance

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Tooltip with image

    Quote Originally Posted by yulyos
    Hi,

    Can you post example of code ?

    Thanks in advance
    You already know that you have to set the OwnerDraw property to True, handle the Draw event and call the e.Graphics.DrawString method. It should not be a big step from there to read the documentation for that method and see what options are available to you. You can even just start typing and Intellisense will tell you what overloads of the method there are and what arguments each has.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    Can you post example of code ?

    Thanks in advance

  11. #11
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    My opinion is, if someone posts a question on a public forum like 'VBFOURM' this question becomes a public question.

    If the person that ask the question accept to get answers from people from all the world,
    this person also need to accept to share with others the solution of his question.

    In this thread I asked twice and privet message also.

    Anyway I found a link to the solution 'ToolTip with image' with big help
    from a person named Rod Stephens from www.vb-helper.com and the link is:
    http://www.vb-helper.com/howto_2005_...w_tooltip.html

  12. #12
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Tooltip with image

    Well as I see it, the purpose of this forum is to help people learn programming, not just giving code. Jmcilhinney told you exactly what you needed to do to write the code yourself, if there was something that wasnt clear to you, you should ask about it.
    Last edited by Atheist; Mar 23rd, 2007 at 10:08 AM.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  13. #13
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    To Atheist:

    Look at your siganture:
    Any code example from me is in VB2005

  14. #14
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Tooltip with image

    Yes? Whats your point?

    We do give code examples around here, but definitly not if you dont try for yourself first. Why couldnt you just try to do what jmcilhinney told you? If you wouldve done that, but still couldnt make it work, you couldve told us your problem and we wouldve helped you. Even given you code example if it was needed.

    If a programmer just copies and pastes code into his application from sites, does he learn anything? Perhaps, but very little.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  15. #15
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    To Atheist:
    Look the dates between my two requests to some code.
    Believe me I tried.

  16. #16
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Tooltip with image

    yolyos,
    What these forum members are saying to you, is that if you read over the conversation that took place in this thread before your first post in it, all the pieces to put the puzzle together are there.

    So if you take all the advice that was already given to the guy who started this thread, you should be able to put together some code on your own to get it working. If you try, but can't get it working, then you should post what code you tried to use, and some of the knowledgable members will likely assist you by making corrections and suggestions to your code.

    Most of the more advanced members of public forums like this, also have jobs and other things going on, and while they COULD make a code example, they don't always have time to. On the other hand, you trying it yourself, and posting back with specific questions when you can't get it working, is much more benefitial to you, because you will get answers faster, and also learn more in the process.

  17. #17
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Tooltip with image

    Quote Originally Posted by yulyos
    Hi,

    To Atheist:
    Look the dates between my two requests to some code.
    Believe me I tried.
    Then show us the code you have, and we'll help you from there. As Kleinma says its the fastest way for you to get help.
    Im not trying to be a pain in the ass but there are just too many people that never learns anything for themselves, they just get on here and ask for code all the time. And I'm not saying you're one of them, but there you have my reason for not just giving away code examples.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  18. #18
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    From all forums that I know the most of them that I like is this forum.

    All I'm saying is: please a little help, that's all.

    You can enter http://yulyos4vbnet.spaces.live.com it is in my signature; I'm a person that likes to share my code with everyone.

  19. #19
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Tooltip with image

    If you look at the third posting (which was mine), a link to an example is already given. If you add e.Graphics.DrawImage into the draw event of that example, then you have the code.

    Of course, you should read up on the subject, rather than just copying the example, otherwise you won't learn anything.

  20. #20
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Tooltip with image

    Hi,

    In china there more then 400 letters
    For the Chinese people it's very easy.

  21. #21
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Tooltip with image

    Quote Originally Posted by yulyos
    Hi,

    In china there more then 400 letters
    For the Chinese people it's very easy.
    Seems to me like you dont want to be helped.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width