Re: Drawing Icons



On Feb 29, 9:57 am, Jason Cavett <jason.cav...@xxxxxxxxx> wrote:
On Feb 29, 12:07 am, "Larry A Barowski"

<ThisisLarrybarAtEngDotAuburnDotLearninginstitution> wrote:
"Jason Cavett" <jason.cav...@xxxxxxxxx> wrote in message

news:c3a6daea-3938-4857-ba34-a97c78c3351a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In addition, I have a weird thing going on with the icons which I have
not able to figure out.  They draw themselves (and it looks good,
too).  Except...the icons are BEHIND the text of the tree nodes.

What are your icons returning for getIconWidth() ?
I'm guessing it is zero or much less than the required
width.

That's actually what's weird.

At the end of the paint function (that I implemented in my icon class)
the icons are returning - IconWidth = 16 OR 32 (depends on which type
of icon I construct), IconHeight = 16.

However, before the paint function occurs, IconWidth and IconHeight
are both 0.

...so...

I tried to START with the IconWidth = 16 and the IconHeight = 16.
Well, that does work.  The text is now shifted over.  Thank you.
However, I'm now back to the problem where my icons can be different
widths depending on the state of the node.  I know you posted about it
up above, but I'm not sure I understand.

Thanks again for your help.

Alright. I got it.

Basically, I have to make sure all my "widths" (and height I suppose,
although I'm forcing that to be = 16px) have to be calculated BEFORE
the paintIcon(java.awt.Component, java.awt.Graphics, int, int) method.

Now, it works beautifully. Thanks again for your help.
.



Relevant Pages

  • Left justifying menu items
    ... I have a question about left justifying things like tree nodes or menu ... items where the capability to place icons next to those items exists. ... ImageIndex will actually shift the text to the left, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Drawing Icons
    ...  Except...the icons are BEHIND the text of the tree nodes. ... What are your icons returning for getIconWidth? ... However, before the paint function occurs, IconWidth and IconHeight ...
    (comp.lang.java.programmer)
  • Re: Drawing Icons
    ... They draw themselves (and it looks good, ... Except...the icons are BEHIND the text of the tree nodes. ... I'm guessing it is zero or much less than the required ...
    (comp.lang.java.programmer)
  • Re: Use icons in shell32.dll for buttons on form?
    ... public extern static int ExtractIconEx(string libName, int iconIndex, ... IntPtr[] largeIcon, IntPtrsmallIcon, int nIcons); ... The first parameter of ExtractIconEx can be use to get icons for exe or dll. ...
    (microsoft.public.dotnet.languages.csharp)