Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 9th, 2007, 8:27 AM   #1
Alias
Newbie
 
Join Date: Oct 2007
Posts: 29
Rep Power: 0 Alias is on a distinguished road
Vista Elements Button

I posted this at another forum I frequent, well, two others all-in-all throughout development, it is at a stage that I am happy to let it go a little more public and thought somone may appreciate it here...

Vista Elements Button

Here we have a shaped button, modelled originally to allow developers applications to look and feel like they were written for Vista, particularly in the circumstance of user account handling where an interface is needed, hence the name. There were a few members of different forums I visit that took part in a small testing phase in order for me to gain feedback in a number of areas when the control and its whole concept were still in this state – thank you for that, btw – but the control has had a few updates, amendments and additions since then.

The first major mentionable improvement is memory consumption. I must admit it was not the first thing on my mind while writing the control and it went unnoticed by any of the testers if I can recall without reference – but it was an issue, as when I did turn to looking at the memory I found I was using a little too much for a button, not being able to recall the odds. With a little perseverance however, I cut it down so that when hosted on a form there is an average working set of 6,176 KB, considering the window consumes a chunk of this averaging at 5,308 KB I am now a little more relieved.

Secondly, and also legitimately concerning, was an issue involved when resizing the control. The controls design is essentially only effective when the layout has an equal ratio, for this reason the decision was made to impose it.

Thirdly, more shapes have been added, meaning you can now select from the following shapes:

* VSquare
* Circle
* Half Oval
* Star*

*The star shape still has some more noticeable room for improvement than other shapes, though still usable in many scenarios.

Lastly, for now, the overlay/shine effect has been improved in terms of the way it is drawn for most shapes, the star being the odd one out and this aspect being one of the above referenced issues. Another note relevant here is that there is now a property to indicate which way the overlay/shine should be drawn, with either a curved or straight centre line.

Platform of the button

As you have probably gathered from above, the control utilises the .NET Framework 2.0 and was written in 100% managed C# using GDI+.

Use of the button

The button control is contained within the VistaElements.dll and must be referenced; here’s how to go about referencing it in a .NET application, note there are two ways:

At compile time:
When about to compile add the following line to the command...
/reference:VistaElements.dll

At design time when using an IDE, Visual Studio in particular:

1. Open your project/solution.
2. In the Solution Explorer right click the project and choose Add Reference from the menu displayed.
3. Select the Browse tab then locate the VistaElements.dll, select it and click Ok.
4. In order for the control to show up in the toolbox you may need to take the additional steps of right-clicking it (the toolbox that is) and selecting Choose Items from the menu, locating the control from the list and checking it for availability.

Now that it is referenced, or will be at time of compilation, you can proceed to expose it from within Visual Studio using the designer, all properties can be set from there; on the other hand you can expose it in the following manner using code:

Note: I was going to remove this section for PFO in particluar, in an attempt to not seem patronising but I figured to aim at the lowest denominator.

C#
    //import namespace
    using VistaElements.VButton;
    //declare a reference in relevant scope 
    private VButton vButton1;
    //or, without the using statement 
    private VistaElements.VButton.VButton vButton1;
    //create a new instance
    vButton1 = new VButton();
    //add it to a control (ie Form)
    Controls.Add(vButton1);


VB.NET
    ‘import namespace 
    Imports VistaElements.VButton;
    ‘declare a reference in relevant scope
    Private vButton1 As VButton
    ‘or without the using statement
    Private vButton1 As VistaElements.VButton.VButton
    ‘create a new instance
    vButton1 = New VButton() 
    ‘add it to a control (ie Form) 
    Controls.Add(vButton1)

Properties of the button

The button is quite customisable; using properties to indicate how the button should look allows this. The following are some of the properties available, mostly colours:

.NET Type: Color
BorderFill0
BorderFill1
ContentFill0
ContentFill1
FocusBorder
FocusInnerBorder
HoverFill
InnerInnerBorder
OuterBorder
OuterInnerBorder
Overlay0
Overlay1
Shadow

.NET Type: LinearGradientMode
GradientBorderMode
GradientContentMode
GradientOverlayMode

.NET Type: Image
Image

.NET Type: String
Text

.NET Type: ContentAlignment
TextAlign – only top, middle and bottom centre supported

.NET Type: Shape
Shape

Enjoy the control, and feel free to make suggestions for improvements, error fix requests etc and as time allows I will certainly take heed.

Alias
Attached Images
File Type: png VistaUserButton.png (395.5 KB, 13 views)
Attached Files
File Type: zip VistaElements1.0.0.1a+Test.zip (28.5 KB, 5 views)
Alias is offline   Reply With Quote
Old Nov 9th, 2007, 8:35 AM   #2
InfiNate
Newbie
 
Join Date: Nov 2007
Location: Waterloo, ON
Posts: 20
Rep Power: 0 InfiNate is on a distinguished road
Re: Vista Elements Button

Those look awesome, well done. Will try them out later and let you know what I think.
InfiNate is offline   Reply With Quote
Old Nov 9th, 2007, 5:25 PM   #3
Alias
Newbie
 
Join Date: Oct 2007
Posts: 29
Rep Power: 0 Alias is on a distinguished road
Re: Vista Elements Button

Thank you, and, look forward to hearing from you.
Alias is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista Sound Driver Issues (Creative Cards) Ghost Coder's Corner Lounge 3 May 31st, 2007 2:36 PM
Applet / Button problem. TCStyle Java 1 Apr 29th, 2007 11:10 AM
Disabling "Ok" button jayme C++ 2 Jan 9th, 2006 4:50 AM
IE and dynamic button creation MegaArcon JavaScript and Client-Side Browser Scripting 5 Dec 6th, 2005 8:31 AM
Browse button??? ktsirig HTML / XHTML / CSS 7 Oct 8th, 2005 6:21 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:20 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC