Is it possible to show a System.Drawing.Image inside a ToolTip?
thanks in advance
Printable View
Is it possible to show a System.Drawing.Image inside a ToolTip?
thanks in advance
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+.
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.
Should have looked at the doco since 2003 shouldn't I. :blush:
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).
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.
thanks guys.
e.Graphics.DrawImage did the trick :)
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.Quote:
Originally Posted by yulyos
Hi,
Can you post example of code ?
Thanks in advance
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
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.
Hi,
To Atheist:
Look at your siganture:
Quote:
Any code example from me is in VB2005
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.
Hi,
To Atheist:
Look the dates between my two requests to some code.
Believe me I tried.
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.
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.Quote:
Originally Posted by yulyos
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.
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.
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.
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.Quote:
Originally Posted by yulyos