• Welcome to Valhalla Legends Archive.
 

Skinning framework for .Net -- .NETskinEx

Started by MyndFyre, August 06, 2005, 04:56 PM

Previous topic - Next topic

MyndFyre

I've always wanted a skinning framework for .NET.  Lately I've been getting good with custom drawing tasks, and I wanted to dive a little more into windows messages and that, and decided to take a crack at it.  After a start in the right direction but some confusion, I stumbled across a blog entry that laid it out.  After getting it working fairly well on the first run, I scrapped what I had and rewrote from the ground up.



Above is a fairly full-featured skin designer program (it doesn't have Save, but it wouldn't be hard to do).  All of the classes related to adding skin elements are marked Serializable, so pretty much all you need to do is make a call to the BinaryFormatter class.

There are two rendering base classes -- SkinElement and MultiStateSkinElement.  They provide interfaces which any custom designer should implement.  For example, there is an implementation of SkinElement called VectorSkinElement -- it allows you to define a GraphicsPath with any number of points with a given pen and brush.

I'm having some problems with some things:
* For whatever reason, when I press and hold a caption-bar button, it doesn't go into its "Pressed" state.  Furthermore, if I move the mouse while I've got it down, it draws the Windows-equivalent button.  Eww!
* Even more confounding is that the above behavior only happens in the debug version -- in the release version, when I roll the mouse off of the button it minimizes/maximizes/closes.
* The transparency key property shouldn't be used like I did (to make the transparent color part of the skin do its thing) -- I want to find another way to allow rounded edges and such.

Things I want to do with this still
This represents a week's worth of time at work (48 hours this week).  It's still in its infancy.
* I want to be able to provide custom painting for any controls that are on the form.
* I want to make a Brush designer, so that (for example) the Title text, since Graphics.DrawString takes a Brush parameter, could be painted with a LinearGradientBrush.
* I need to implement the basic SkinElement designer window, which means I need to implement extensibility.  The idea is that you could tack-on other .NET assemblies and use them as additional skin element renderers.  The form that pops up when you click the "..." button in the skin designer is supposed to let you do that.
* I want to create a custom-drawn Menu framework (flat Office 2003-like menus) and provide a way for that to be integrated.

I'll be adding several properties and methods over the time ahead when I get to play with this, so don't expect me to worry about compatibility until I make an "official" release.  The code I've posted is free to be used in whatever non-commercial means you wish, as will be true of any future releases I make.  I also am welcome to any comments/criticisms you might have.

Code/binaries:
http://www.jinxbot.net/pub/netskinex.zip
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Topaz


MyndFyre

Ooops, I fixed the link to the code/binaries.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

MyndFyre

I have updated this.

Web documentation: here (note that this is severely incomplete)
Binary/code/HTML Help: here

I have fixed transparency so that the transparent parts are on a per-skin-element basis.
I have made a brush designer, but need to add Path- and LinearGradient brushes to it.
I need to make a Path designer, or find one online.
Button "pressed states" are fixed.
I still need to make a SkinElement designer window.
Better design-time support.
I added the ability to make the form have a drop-shadow in Windows XP by overriding the DropShadow property in the derived form and returning true.  This is *NOT* a design- or run-time property.
I updated the skin designer to support saving/opening and preview.

I would greatly appreciate any assistance you guys could offer in terms of testing and finding runtime bugs.  Please post anything you find here.

This code is released under the terms of the GNU General Public License.  If you wish to use this project in a non-GNU project, please contact me and we can make arrangements to do so.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Warrior

Myndfyre, I don't know how you do it man.
Good job.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?


MyndFyre

#6
This is updated.  Same links as above -- code/binaries and documentation online.  Only a few changes:
-- Fixed the button weirdness on the caption bar.
-- Documented a FEW (notably FEW) things
-- Added support for ISerializable on MSImageSkinElement
-- Added a DEBUG build tool that you can use to watch stack traces.
-- I think that's it.

This code is released under the terms of the following (FreeBSD-like) license:
Copyright 2004-2005 The .NETskinEx Project. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE .NETSKINEX PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the .NETskinEx Project.
--End license--
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.