How do i use this to create a tooltip?
Ive tried looking through all articles in MSDN website but i just cannot get my head round it.
Thanks,
Ash
From stackoverflow
-
Is this what you're looking for? You shouldn't need to use interop for tooltips.
Ash : I tried this but to actually show the tooltip you need to use the IWin32Window thing because its one of the parameters needed to show the object. Thanks though :) -
What exactly is it you want to do? For most purposes, you just add a
Tooltipand set values against controls. Some controls provide their own tool-tip (and mechanism to set the text).[STAThread] static void Main() { // example code only... doesn't do cleanup Application.EnableVisualStyles(); Button btn = new Button(); Form form = new Form(); form.Controls.Add(btn); ToolTip ttip = new ToolTip(); ttip.SetToolTip(btn, "Hello world"); Application.Run(form); }
re the comment; then just something like:
form.Shown += delegate { ttip.Show("hi", form, 0,0, 3000); };(where
formcould be the form, "this", or any control)Ash : I just want to show a tooltip for now that jus shows some text nothing fancy, i wana hard code the text in and show it onload.Ash : The code before thats in C# does the same as this but i dont think this will actually show the tooltip, well didnt when i last tried itMarc Gravell : see update for just showing it standaloneAsh : Ohhhh so the iWin32 thing is just any control on the form? Including the form?Ash : I seee! Thanks dudee got it working :DMarc Gravell : Yes - all controls provide a windows handle - i.e. an IWin32Window
0 comments:
Post a Comment