Thread: Gui problem...
View Single Post
  #9  
Old 08-09-2007, 04:10 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Yes, first do seticonsize(w, h);
Then the icon variable is actually a TDrawingPanel object that you can use various functions such as:
  • icon.drawimage(int x, int y, str imagefilename)
  • icon.drawimagerectangle(int x, int y, str imagefilename, int sourcex, int sourcey, int sourcewidth, int sourceheight)
  • icon.drawimagestretched(int x, int y, int width, int height, str imagefilename, int sourcex, int sourcey, int sourcewidth, int sourceheight)

Here's an example:
NPC Code:
new GuiTreeViewCtrl("mytree") {
resize(0, 0, 50, 100); // sets x, y, w and h
seticonsize(32, 32);
clearnodes();
with (addnode("Category A")) {
icon.drawimagestretched(0, 0, 32, 32, "block.png", 0, 0, 32, 32);
with (addnode("Item A")) {
icon.drawimagestretched(0, 0, 32, 32, "head0.png", 0, 0, 32, 64);
}
with (addnode("Item B")) {
icon.drawimagestretched(0, 0, 16, 16, "bcalarmclock.png", 0, 0, 32, 32);
icon.drawimagestretched(16, 0, 16, 16, "bcalarmclock.png", 0, 0, 32, 32);
icon.drawimagestretched(16, 16, 16, 16, "bcalarmclock.png", 0, 0, 32, 32);
icon.drawimagestretched(0, 16, 16, 16, "bcalarmclock.png", 0, 0, 32, 32);
}
}
}

__________________
Do it with a DON!
Reply With Quote