CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 05-04-2013, 03:18 PM   #1
fajar
Frequenter
portfolio
fajar
Airdrie, Canada
 
Join Date: May 2009
Posts: 131
Thumbs up dotnet List View Horizontal Padding

is there any setting in listView [properties or something] that making horizontal padding become not so far for each control.

currentlly



become something like this



currently im using this setup

Code:
fn initLv theLv = ( theLv.View = (dotNetClass "System.Windows.Forms.View").LargeIcon theLv.Multiselect = true theLv.Scrollable = true theLv.margin =dotnetobject "System.Windows.Forms.Padding" 1 --doesnt work theLv.Padding =dotnetobject "System.Windows.Forms.Padding" 1 --this doesnt work )


thanks for the guidance
 
Old 05-04-2013, 05:39 PM   #2
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,837
 
Old 05-04-2013, 06:19 PM   #3
fajar
Frequenter
portfolio
fajar
Airdrie, Canada
 
Join Date: May 2009
Posts: 131
Thanks mr.Lo , but im not that advanced user ,still in progress of learning in dotnet ms, could you ascend how to use it in my ms.... I know little bit of compiling thing in ms but still dont know how to use it tho.

Code:
fn compileThis = ( title ="" title+="using System.Runtime.InteropServices;\n" title+="[DllImport(\"user32.dll\")]\n" title+="public static extern int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);\n" title+="public int MakeLong(short lowPart, short highPart)\n" title+="{\n" title+="\treturn (int)(((ushort)lowPart) | (uint)(highPart << 16));\n" title+=" }\n" title+="public void ListViewItem_SetSpacing(ListView listview, short leftPadding, short topPadding)\n" title+="{\n" title+= "\tconst int LVM_FIRST = 0x1000;\n" title+="\tconst int LVM_SETICONSPACING = LVM_FIRST + 53;\n" title+="\tSendMessage(listview.Handle, LVM_SETICONSPACING, IntPtr.Zero, (IntPtr)MakeLong(leftPadding, topPadding));\n" title+="}\n" compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters" compilerParams.ReferencedAssemblies.AddRange #("user32.dll","System.Windows.Forms.dll"); compilerParams.GenerateInMemory = true compilerResults = (dotnetobject "Microsoft.CSharp.CSharpCodeProvider").CompileAssemblyFromSource compilerParams #(title) ) compileThis() ( Global myScenes # () Global imageList = dotNetObject "System.Windows.Forms.ImageList" try destroyDialog myImageTest catch() Rollout myImageTest "Scenes" width:500 height:500 ( dotNetControl sceneLv "System.Windows.Forms.ListView" width:480 height:480 fn initLv theLv = ( theLv.View = (dotNetClass "System.Windows.Forms.View").largeIcon theLv.Multiselect = true theLv.Scrollable = true theLv.margin =dotnetobject "System.Windows.Forms.Padding" 1 theLv.Padding =dotnetobject "System.Windows.Forms.Padding" 1 ) fn fillLv theLv = ( colorclass = (dotnetclass "system.drawing.color") theLv.Clear() theLv.items.Clear() theLv.Refresh() imageList.images.Clear() imageList.Dispose() imageList.imagesize = dotnetobject "System.Drawing.Size" 150 150 imageList.ColorDepth = imageList.ColorDepth.Depth32Bit theLv.backcolor = theLv.backcolor.fromARGB 50 50 50 theLv.forecolor = colorClass.white local thumbs = #() local items = #() for s = 1 to myScenes.count do ( filePrefix = (getFilenamePath myScenes[s]) + (getFilenameFile myScenes[s]) thumbFile = filePrefix + ".jpg" maxFile = filePrefix + ".max" append thumbs ((dotNetClass "System.Drawing.Image").fromFile thumbFile) item = dotNetObject "System.Windows.Forms.ListViewItem" (filenameFromPath maxFile) item.name = maxFile item.imageIndex = s - 1 --myborder=dotNetObject "System.Windows.Forms.BorderStyle.Fixed3D" theLv.items.add item ) imageList.images.addrange thumbs theLv.LargeImageList = imageList theLv.SmallImageList = imageList for t in thumbs do t.dispose() ) on sceneLv mouseUp arg do ( hit=(sceneLv.HitTest (dotNetObject "System.Drawing.Point" arg.x arg.y)) if(hit != undefined AND hit.item != undefined) then ( -- hit.item.name has full path of max scene print hit.item.name ) ) fn collectScenes = ( myScenes = getFiles "D:\\*.max" ) on myImageTest open do ( initLv sceneLv collectScenes() fillLv sceneLv ) on myImageTest close do ( imageList.dispose() ) ) createDialog myImageTest )


where i must put the "ListViewItem_SetSpacing(this.listView1, 64 + 32, 100 + 16);" line ?

thanks for your answer.
 
Old 05-05-2013, 12:00 AM   #4
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,508
Send a message via ICQ to denisT
Quote:
Originally Posted by fajar
Thanks mr.Lo , but im not that advanced user ,still in progress of learning in dotnet ms, could you ascend how to use it in my ms.... I know little bit of compiling thing in ms but still dont know how to use it tho.

you don't need any on-fly compiled assembly. you can do it with pure mxs. the only thing that you need is to send the right message to the right control. it's one line of code... if you can wait i will show it tomorrow.
 
Old 05-05-2013, 03:35 AM   #5
fajar
Frequenter
portfolio
fajar
Airdrie, Canada
 
Join Date: May 2009
Posts: 131
Ok thanks ....will wait till tomorrow then, right now just try a thing up.
Thanks denisT
 
Old 05-05-2013, 08:24 AM   #6
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,837
Code:
fn setListViewSpacing lv leftPadding topPadding = ( local hWnd = lv.handle local LVM_SETICONSPACING = 0x1000 + 53 local lParam = bit.or (bit.shift topPadding 16) leftPadding windows.SendMessage hWnd LVM_SETICONSPACING 0 lParam )


Keep in mind that:
  • The listview must already be created (it must have a valid handle)
  • The values for padding must include the size of the icons, otherwise you will get an invalid result. For example, in your case, to get 0 padding between the icons, you must pass values of 150 and 150 for the padding.
  • Sending a value of -1 will reset the padding to default.
 
Old 05-05-2013, 11:17 AM   #7
fajar
Frequenter
portfolio
fajar
Airdrie, Canada
 
Join Date: May 2009
Posts: 131
Thank you so much Mr.Lo, your function just work fine.
 
Old 05-05-2013, 11:17 AM   #8
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:48 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.