Skinning

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

I am interested in learning a bit about skinning.
I found an article:
http://www.developerfusion.com/show/3899/
However, it says the method shown is "not very practical."

Is there a good tutorial you can recommend? Or, is it something hard enough
that I should purchase a solution from somebody?

Thanks in advance,

Matthew
 
Matthew,

Did you tried this for fun made sample of me?

\\\made by Cor Ligthert from ideas I got from Herfried. K. Wagner and Fergus
Cooney
Private WithEvents button1 As New Button
Private mouseX, mouseY As Integer
Private myMouseDown As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As New System.Drawing.Drawing2D.GraphicsPath
g.AddString("HTH" & vbCrLf & "Cor", _
System.Drawing.FontFamily.GenericSansSerif, _
System.Drawing.FontStyle.Bold, 200, _
New Point(0, 0), _
System.Drawing.StringFormat.GenericDefault)
Me.BackColor = Color.Red
Me.Region = New System.Drawing.Region(g)
g.Dispose()
Me.AutoScaleBaseSize = New System.Drawing.Size(0, 0)
Me.ClientSize = New System.Drawing.Size(500, 450)
button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
button1.ForeColor = System.Drawing.Color.Black
button1.Location = New System.Drawing.Point(425, 18)
button1.Size = New System.Drawing.Size(20, 20)
Me.Controls.Add(button1)
button1.Text = "X"
Me.Location = New System.Drawing.Point(50, 50)
End Sub
Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles button1.Click
Me.Close()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal _
e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
myMouseDown = True
mouseX = Cursor.Position.X - Me.Location.X
mouseY = Cursor.Position.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e _
As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMouseDown Then
Me.Location = New System.Drawing.Point(Cursor.Position.X _
- mouseX, Cursor.Position.Y - mouseY)
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
myMouseDown = False
End Sub
///
I hope this helps?

Cor
 
Hi Matthew,

Ever messed around with XML? If not it would be a good idea that you
did, because it is perfect for what you are after. You could make your own
skinning engine and mark-up language, and I doubt it would be that hard. I
have often wanted to do this myself by have never got around to it, it would
be great for multi-lingual solutions!

Anyway, I have a couple of XML links for you,

http://www.planet-source-code.com/v...lngWId=10&txtForceRefresh=1017200416265792200

http://www.members.lycos.co.uk/nickpatemanpwp/
My own software > Flying Frank Circus, quite a large project but shows
how to deal with loading XML (one of my first examples so it's not amazing,
but fun ;-) )

XML is excellent once you get the hang of it, I make quite allot of my
objects XML persistable, it's much easier to do it this way than via comma
delimited text documents that will have you searching for errors for hours!

Anyway, if your stuck on the concept of how to implement this, I suggest
you make a borderless form that loads its elements via XML and a shared
method. i.e. mySkinnedForm.fromFile("c:\pop.xml"). The XML file should
state positions and relevant graphics of controls, as well as their anchor
points. You will obviously have to a pool of objects for the form to load
from as it would be mighty tricky to get it to make controls that you
weren't expecting. A tiny example would be,

<?xml version="1.0"?>
<skinfile>
<objects>
<object>
<name>closebutton</name>
<location>10,10</location>
<size>50,15</size>
<normalbitmap>\normal.png</normalbitmap>
<overbitmap>\over.png</overbitmap>
<downbitmap>\down.png</downbitmap>
</object>
</objects>
</skinfile>

You could even add "scripts" to object events and do "on-the-fly"
compilation of .NET code. I done this for a project recently and found it
really fun, I hope this helps!

Nick.
 
Ever messed around with XML? If not it would be a good idea that you
did, because it is perfect for what you are after.

Yes, I have done some work with XML. However, I didn't consider it for this
aplication. I love the idea!
I have a couple of XML links for you

I will check them out.
You could even add "scripts" to object events and do "on-the-fly"
compilation of .NET code.

That's an interesting concept. Do you have an example handy?

By the way, Nick, I hear that you are quite the expert on Shareware. I have
written a small program that I am considering distributing using this
method. Do you have any tips? Is there anything I should watch out for?

Matthew
 
Did you tried this for fun made sample of me?

Thanks for the example, Cor. I will check it out.

Matthew
 
Hi Matthew,
By the way, Nick, I hear that you are quite the expert on Shareware. I
have written a small program that I am considering distributing using this
method. Do you have any tips? Is there anything I should watch out for?

I wouldn't exactly call myself an expert, far from it, but I have just
started selling my own software/ Yeah, I would love to give some advice,

-----------

* Don't try and make time limited demos of your software, they can be
easily cracked and people will end up turning the demo into a full version

* When making a demo, make it completely impossible to turn it into
the full version by using pre-compile constants evalution, for example,

# if (Not DEMOVERSION)
'do full version stuff
# else
'display message saying "you can't do that in the demo!"
# endif

* I would personally recommend a license file based system, this way
noone is going to be making key-generators for your application. I've used
signed XML files for my application, so if people "share" their license
file, they have been caught red-handed and I can brand their license as
invalid, no support for them! (Not that you can do much else about it).

* Get it onto a web site in demo and version as quick as you can,
you'll soon start refining it and getting bug reports in that you hadn't
even noticed.

-----------

I took ages getting mine online, but now it's on it's taking a whole new
lease of life, I'm looking forward to getting it onto Tucows (I hope I can),
because then I'll be able to see my monthly bandwith ebbing away from me!
Anyway, I recommend control licensing also if you are distributing a class
library with your project, so look at this article,

http://windowsforms.net/articles/Licensing.aspx

I will be selling my solution sooner or later, but that's a while off,
and it's going to be allot cheaper than anyone elses, but this isn't an
advert anyway (bla bla bla). But basically it was created by referring to
the above article and working out how the license provers work in the .NET
Framework (And most parts seem to still be undocumented).

Anyway, good luck none the less! I hope you get things done quicker
than myself! (1.5 years roughly!) :-)

Nick.
 
You could even add "scripts" to object events and do "on-the-fly"
compilation of .NET code.

That's an interesting concept. Do you have an example handy? I'm afraid I
don't have any idea where to start with this.
* Don't try and make time limited demos of your software, they can
be easily cracked and people will end up turning the demo into a full
version

Nice thought. My software is designed for presentation; I will put a
watermark on the "display" part. That oughta be enough ;-)
* When making a demo, make it completely impossible to turn it into
the full version by using pre-compile constants evalution, for example,

# if (Not DEMOVERSION)
'do full version stuff
# else
'display message saying "you can't do that in the demo!"
# endif

I am not sure what you mean by pre-compile constants.

What I am doing now looks like this:
Private Sub Form1_Load( 'etc
If isRegistered() = True Then
'full version stuff
end if
End Sub

'in a module:
Function isRegistered()
if [regestration key exists in external text file and validates correctly]
then
return True
else
return false
end if
end function

Does this sound OK?
* I would personally recommend a license file based system, this way
noone is going to be making key-generators for your application. I've
used signed XML files for my application, so if people "share" their
license file, they have been caught red-handed and I can brand their
license as invalid, no support for them! (Not that you can do much else
about it).

I agree, licensing is the way to go. The concept of signed XML files sounds
very interisting. Can you point me in the right direction for some
information?
* Get it onto a web site in demo and version as quick as you can,
you'll soon start refining it and getting bug reports in that you hadn't
even noticed.

Sounds good to me. My app is not really complex. I am shooting for a
release in the next couple of weeks.
I took ages getting mine online, but now it's on it's taking a whole
new lease of life, I'm looking forward to getting it onto Tucows (I hope I
can), because then I'll be able to see my monthly bandwith ebbing away
from me! Anyway, I recommend control licensing also if you are
distributing a class library with your project, so look at this article,

http://windowsforms.net/articles/Licensing.aspx

I wish I saw that before I created my own liscensing scheme. I'm going on
vacation for a week, but I'll look at that closely when I get back.
Anyway, good luck none the less! I hope you get things done quicker
than myself! (1.5 years roughly!) :-)

As I said above, my app is very simple. My guess is it can't really compare
to your 1.5 year project ;-)
Thanks for your help.

Matthew
 
Matthew,

Almost a year ago Nick wrote "My programs need no obfuscator, I do not
understand them myself"

I found that then one of the best oneliners I saw about programming I will
remember it me forever including who wrote it.

It must have changed, as you see how much time he took to get this right the
last months.

:-)

Cor





Matthew said:
You could even add "scripts" to object events and do "on-the-fly"
compilation of .NET code.

That's an interesting concept. Do you have an example handy? I'm afraid
I don't have any idea where to start with this.
* Don't try and make time limited demos of your software, they can
be easily cracked and people will end up turning the demo into a full
version

Nice thought. My software is designed for presentation; I will put a
watermark on the "display" part. That oughta be enough ;-)
* When making a demo, make it completely impossible to turn it into
the full version by using pre-compile constants evalution, for example,

# if (Not DEMOVERSION)
'do full version stuff
# else
'display message saying "you can't do that in the demo!"
# endif

I am not sure what you mean by pre-compile constants.

What I am doing now looks like this:
Private Sub Form1_Load( 'etc
If isRegistered() = True Then
'full version stuff
end if
End Sub

'in a module:
Function isRegistered()
if [regestration key exists in external text file and validates correctly]
then
return True
else
return false
end if
end function

Does this sound OK?
* I would personally recommend a license file based system, this
way noone is going to be making key-generators for your application.
I've used signed XML files for my application, so if people "share" their
license file, they have been caught red-handed and I can brand their
license as invalid, no support for them! (Not that you can do much else
about it).

I agree, licensing is the way to go. The concept of signed XML files
sounds very interisting. Can you point me in the right direction for some
information?
* Get it onto a web site in demo and version as quick as you can,
you'll soon start refining it and getting bug reports in that you hadn't
even noticed.

Sounds good to me. My app is not really complex. I am shooting for a
release in the next couple of weeks.
I took ages getting mine online, but now it's on it's taking a whole
new lease of life, I'm looking forward to getting it onto Tucows (I hope
I can), because then I'll be able to see my monthly bandwith ebbing away
from me! Anyway, I recommend control licensing also if you are
distributing a class library with your project, so look at this article,

http://windowsforms.net/articles/Licensing.aspx

I wish I saw that before I created my own liscensing scheme. I'm going on
vacation for a week, but I'll look at that closely when I get back.
Anyway, good luck none the less! I hope you get things done quicker
than myself! (1.5 years roughly!) :-)

As I said above, my app is very simple. My guess is it can't really
compare to your 1.5 year project ;-)
Thanks for your help.

Matthew
 
Hi Matthew,
That's an interesting concept. Do you have an example handy? I'm afraid
I
don't have any idea where to start with this.

Ooops! Sorry, I forgot to include an example. Ive attached a ZIP to
this message with one in. Be warned that it would be easy for people to
make mallicious files, unless you load the object using restricted security,
not something I've done yet.

1) Compile the example and run
2) Press "create the fly object!"
3) Browse to "flyObjectFile.vb" in the project folder
(notice how the text of the form has changed to "Bob")
4) Press "set property" and give it a new name, such as "Fek"
(notice how the text of the form has changed to "?")
5) Press "call method" and give a string to send to the method, it will
now display a messagebox with "? says said:
Nice thought. My software is designed for presentation; I will put a
watermark on the "display" part. That oughta be enough ;-)

Sounds like a cool idea! I just believe that making time-limited
software is like flogging a dead horse!
I am not sure what you mean by pre-compile constants.

What I am doing now looks like this:
Private Sub Form1_Load( 'etc
If isRegistered() = True Then
'full version stuff
end if
End Sub

Well, if you load up your project properties, then goto "Configuration >
Build" you can then enter your own custom constants, make one called "FEK =
True" Now if you put the code

#if (FEK)
'do stuff
#endif

"'do stuff" will only be compiled if FEK is True, so if it doesnt get
compiled the code wont be in the binary! You can use this method for loads
of uses, but you might be just as well off with how your doing it right now,
after all if you are only releasing 1 binary there should be no need :-)
'in a module:
Function isRegistered()
if [regestration key exists in external text file and validates correctly]
then
return True
else
return false
end if
end function

Yeah, that should do the trick, it's pretty easy to hack something like
that, but then again you shouldnt think like that as all code is hackable
:-( So yeah, that should do the job fine.
I agree, licensing is the way to go. The concept of signed XML files
sounds
very interisting. Can you point me in the right direction for some
information?

Well it's not easy to explain, but I could give some keywords that should
help loads,

* System.Security.Cryptography.Xml
* RSA Public key encryption
* SignedXML class

You will need to make a key pair first, when I make them I store them as
files, I have an example of this,

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1648&lngWId=10

You can then load the files up with the Cryptography name space and use
the "Private" key to sign, and the "Public" key to verify!
As I said above, my app is very simple. My guess is it can't really
compare
to your 1.5 year project ;-)

Well, there was allot of fannying about on my behalf, I could have been
so much quicker, but things get in the way.
Thanks for your help.

No probs, good luck :-)

Nick.
 
Hi Cor,
Almost a year ago Nick wrote "My programs need no obfuscator, I do not
understand them myself"

I remember saying that, around the time of Fergus?
It must have changed, as you see how much time he took to get this right
the last months.

LOL!

Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

BOINC Skins 6
change bordertype and color 1
Skins and Images 1
Site Skinning 1
3d Text 2
"select skin file" message 3
Need help with skin file for Usercontrol 1
Today I learned... 717

Back
Top