PDA

View Full Version : how to use .bmp as icons (with mask) in DotNet Listview


abyjoe
05-10-2008, 07:13 PM
i have tried to search but couldnt find anything regarding this...

if i want to use multiple icons in dotnet listview.... can i not use the standard .bmp files with multiple icons and specify the index??? i dont want to have too many individual .ico files...

as an example I am using the Net_ListViewWrapper.ms file in C:\Program Files\Autodesk\3ds Max 2008\stdplugs\stdscripts

abyjoe
05-11-2008, 07:00 PM
could someone post an example where you use one of the .bmp file in UI folder
as icon for listitems using imagelist.... cant figure out

MarcoBrunetta
05-11-2008, 07:32 PM
The "Converting ActiveX TreeView Control to DontNet TreeView Control" help item has an example of this beeing done. While itīs a TreeView and not a ListView the example should be clear enough for you to grasp the fundamentals.

abyjoe
05-11-2008, 08:06 PM
thanks man... i overlooked that one... i looked at part one and not second... instead i saw the listview one where they use an .ico file and i couldnt figure out how to use bmp in that one...

I am now using the activeX treeview control example part 2 and it works fine

apparently this does not allow masking to get rid of the background from the icons... !!! is there a way I can get the mask working in this one...

LoneRobot
05-12-2008, 02:04 PM
Hi AbyJoe,

to use a DotNet treeview and specify transparent backgrounds on the icons you will have to add the images into an imagelist dotnet object. For this you can use bmps, pngs, jpgs or ico files. take a look at the following example. you can perform the same method with dotnet buttons in order to extend their appearance. This would be easy to apply the same process to treeview/listview icons.

rollout DotNetTest ".Net UI on MXS Form"
(

dotnetcontrol mbutton "System.Windows.Forms.Button" height:60 width:80 pos:[5,5]
dotnetcontrol mbutton2 "System.Windows.Forms.Button" height:60 width:80 pos:[88,5]

on dotnettest open do
(
mcolor = dotnetclass "System.drawing.color"
malign = dotnetclass "System.Drawing.ContentAlignment"

maxBackColor = colorMan.getColor #background
DotNetBackColor = mColor.FromArgb (maxBackColor[1] * 255.0f) (maxBackColor[2] * 255.0f) (maxBackColor[3] * 255.0f)

imageclass = dotNetclass "System.Drawing.image"
IListimage1 = imageclass.fromfile (LRUIdir+"zfstart.bmp")
IListimage2 = imageclass.fromfile (LRUIdir+"zfstop.bmp")

imglist = dotnetobject "System.Windows.Forms.ImageList"
imglist.imagesize = dotnetobject "System.Drawing.Size" 64 35
imglist.images.add ilistimage1
imglist.images.add ilistimage2
imglist.TransparentColor = mcolor.white

mbutton.text = "Add Start"
mbutton.flatstyle = dotnetobject "System.Windows.Forms.FlatStyle" Flat
mButton.TextAlign = malign.BottomCenter
mbutton.imagealign = malign.topcenter
mbutton.FlatAppearance.MouseOverBackColor = mcolor.limegreen
mbutton.backcolor = DotNetBackColor

mButton2.text = "Add Stop"
mbutton2.flatstyle = dotnetobject "System.Windows.Forms.FlatStyle" Flat
mbutton2.imagealign = malign.topcenter
mButton2.TextAlign = malign.bottomCenter
mbutton2.FlatAppearance.MouseOverBackColor = mcolor.coral
mbutton2.backcolor = DotNetBackColor

mbutton.ImageIndex = 0
mbutton.ImageList = ImgList
mbutton2.imageindex = 1
mbutton2.ImageList = ImgList
)

on mbutton click do
(
print "start pressed"
)

on mbutton2 click do
(
print "stop pressed"
)

)
createdialog dotnettest 175 80 style:#(#style_toolwindow, #style_sysmenu)

abyjoe
05-12-2008, 08:29 PM
thanks dude.. i finally understand this now

CGTalk Moderation
05-12-2008, 08:29 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.