![]() |
|
[.NET] Vb.Net Aero ListView , make your listview look better (ctrl + source) simple tut - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Vb.Net Aero ListView , make your listview look better (ctrl + source) simple tut (/showthread.php?tid=1486126) Pages: Pages
1
2
|
Vb.Net Aero ListView , make your listview look better (ctrl + source) simple tut - nathan72389 - Jul 15, 2011 Ok.. since we all love the listview control in VS, but if your like me, hate the way it looks (does it not look like it fell out of win 95'?) then this VERY simple control will soon become a quick replacement. lets start by checking out the differences in the standard listview and the "Areo listview": [img]http://img691.imageshack.us/img691/926/715201121245pm.png[/img] ^^ on the left is the standard listview, but on the right is our new areo listview. both of them are set to simply display something in detail mode, with some garbage that is being displayed. so, what has change? well, if the image dont say it all, then i will tell you, .. The appearance! our new one (the one on the right) looks like it fits into windows vista / 7 more, and dont look 10 years old. lets do another example: [img]http://img24.imageshack.us/img24/9227/715201121906pm.png[/img] this time i did it with pictures...(dont that just look better ?) ok, thats all for the demo, and you might be thinking that this is some custom drawn listview. well, no, its not. starting with windows vista you can now apply the windows themes (areo) to different controls found around the windows environment. since i use a listview (alot) this is one control class that i made and have always loaded it up when i need a listview. dude, shutup and show some code! ok, ok lets start. make a new class and call it something close to what the control is. (AreoListView) then import "System.Runtime.InteropServices" make it "inherit" a listview you will need to declare this api: Code <DllImport("uxtheme", CharSet:=CharSet.Unicode)> _now, we will add an event handler for when the handle is created we can go ahead and use our api to make it look "pretty" Code Private Sub AreoListView_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.HandleCreatedso the api call is basically like this.. me.handle (the handle to the control to change) "explorer" (this is just a marker that windows uses, its not that important) nothing (this is the pram for the theme(anything other than "nothing, 0, nill" will force it back to the old way and defeat the whole point of the ctrl)) now, one issue that i always hate with listviews, are that they flicker when they are being updated.. lets solve this now.. Code Sub New()ah, much better. ok so close the class and debug your app, close it, then check the toolbox for your new control. done! now you can use a listview that fits with windows vista / 7 a little better than that ugly solid blue selections. just incase anyone is wondering about XP, this will not crash on an xp box, but also, it wont do anything. anyway, here is my whole class for the control: Code Imports System.Runtime.InteropServicesso, i hope that everyone enjoyed themselves and can use this in making your programs a little more pleasing to the eye. * - hacku4eva - Jul 15, 2011 thanks for the share, nathan it looks great * - RBH - Jul 15, 2011 Nice release, haven't seen you in a long time! * - Emilnerd - Jul 15, 2011 Nice share m8 :D, i found this for some days ago on a site, im using it for my admin client P.S i think this is what Leaf admin client uses ;) * - iBoNeT - Jul 15, 2011 Nice release. ;) Thanks. * - nathan72389 - Jul 15, 2011 (Jul 15, 2011 12:14 PM)I am a Pirate! Wrote: Nice release, haven't seen you in a long time! im still around. (Jul 15, 2011 12:21 PM)Emilnerd Wrote: Nice share m8 :D, i found this for some days ago on a site, im using it for my admin client yeah, i mean, its not like a HUGE secret or anything... but i just thought i would post it up. P.S. ... i never checked out "leaf" so... ok. * - Ph03.nix - Jul 15, 2011 That looks really cool. Big thanks for sharing! * - Emilnerd - Jul 15, 2011 (Jul 15, 2011 01:14 PM)nathan72389 Wrote: im still around. Well, thanks for posting :) * - ubbelol - Jul 15, 2011 I wonder why there's no property for this by microsoft as default. Shame on them, good share anyhow. * - nathan72389 - Jul 15, 2011 (Jul 15, 2011 02:20 PM)UbbeLoL Wrote: I wonder why there's no property for this by microsoft as default. the funny thing, (and i may be off) i think delphi 09', 10' or w/e the 2nd to latest ide (and xe) did have this as a property. idk why M$ didnt include it, seems to me, if it dont f-up on XP and lower,m then just make it a default in the framework. * - xSilent - Jul 15, 2011 Yet again, something else awesome from nathan! * - Xenon - Jul 15, 2011 Pretty nice as always. Thanks for the share. * - nathan72389 - Jul 15, 2011 (Jul 15, 2011 04:29 PM)Xenon Wrote: Pretty nice as always. Thanks for the share. thanks man, like i said, its not a big secret, but +1 (not rep wise) for the post count. * - ubbelol - Jul 16, 2011 (Jul 15, 2011 02:30 PM)nathan72389 Wrote: the funny thing, (and i may be off) Actually what do this look like on < XP? ;o * - KingCobraXD - Jul 16, 2011 (Jul 16, 2011 02:35 AM)UbbeLoL Wrote: Actually what do this look like on < XP? ;o I believe it looks regular on XP. =) |