Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development


Reply
 
Share Thread Tools Display Modes
Old 07-24-2009, 03:09 PM   #1
FLAC
 
Join Date: May 2006
Location: Calgary, Alberta
Posts: 1,542
Maheriano will become famous soon enoughMaheriano will become famous soon enough
Question About Designing Skinnable Front End In .NET.

If I were to open Visual Studio and use the designer to place a bunch of buttons on the screen and end up with an application that works like Road Runner, how do I make that skinnable? It seems as simple as going in and changing the location() parameters to point to variables instead of integers and then load those variables from the skin .ini files but this designer code is generated on the fly from the design form by Visual Studio. So if you load them as variables, you'll no longer be able to view the designer because the variables won't be available at design time (or will they?). And even if they are, the second you make a change it'll overwrite all that code you changed. Is there a secret I don't know about?
__________________
Ampie Case
2.5" Hard Drive 80GB Samsung 5400RPM
256 MB DDR2 PC5400
Xenarc 700TSV - VGA Monitor
Intel D945GCLF Motherboard
M2-ATX-HV

2005 Honda Civic
Maheriano is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 07-24-2009, 03:55 PM   #2
North of the land of Hey Huns
 
malcom2073's Avatar
 
Join Date: Jun 2004
Location: Westminster, MD
Posts: 1,039
malcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to all
Maherino: No, there is no secret. You cannot use designer to design your skins.

Instead of placing controls, just start with a blank form. Then make a function, for which all the buttons will trigger. You read from the ini file to get the position and name of all the buttons you want, and create an array to hold the buttons. Create new buttons as per the ini file and place them in this array, at the same time setting their click method to the function. In the click method, check the name of the button (set in the ini file) against a list of common commands.

This is a very simple way, if you want I can push out some simple c# code to do just this.
__________________
RevFE - Try it, you just might like it.
Carbon - Next Generation Touchscreen Browser
Come join us on IRC: irc.efnet.net #mp3car
Audiophiles make me chuckle as they pad my wallet.
malcom2073 is offline   Reply With Quote
Old 07-24-2009, 04:03 PM   #3
North of the land of Hey Huns
 
malcom2073's Avatar
 
Join Date: Jun 2004
Location: Westminster, MD
Posts: 1,039
malcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to all
I got bored:

Skin file:

Code:
button,100,100,100,35,"Test Button",CMD_PLAY button,200,100,100,35,"Test Button",CMD_PAUSE button,300,100,100,35,"Test Button",CMD_STOP

Form1.cs:
Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace SkinTest { public partial class Form1 : Form { public Form1() { this.Load += new System.EventHandler(this.Form1_Load); this.ClientSize = new System.Drawing.Size(598, 394); } List<Control> controlList; private void Form1_Load(object sender, EventArgs e) { controlList = new List<Control>(); String[] array = File.ReadAllLines("test.skin"); for (int i = 0; i < array.Length; i++) { Control tmpControl;// = new Control(); String[] split = array[i].Split(','); if (split[0] == "button") { tmpControl = new Button(); tmpControl.Parent = this; this.Controls.Add(tmpControl); tmpControl.Location = new Point(int.Parse(split[1]),int.Parse(split[2])); tmpControl.Size = new Size(int.Parse(split[3]),int.Parse(split[4])); tmpControl.Text = split[5]; tmpControl.Name = split[6]; tmpControl.Click += new EventHandler(ButtonClick); controlList.Add(tmpControl); } } } private void ButtonClick(object sender, EventArgs e) { MessageBox.Show("Button Clicked: " + ((Button)sender).Name); } } }

__________________
RevFE - Try it, you just might like it.
Carbon - Next Generation Touchscreen Browser
Come join us on IRC: irc.efnet.net #mp3car
Audiophiles make me chuckle as they pad my wallet.
malcom2073 is offline   Reply With Quote
Old 07-24-2009, 04:03 PM   #4
FLAC
 
Join Date: May 2006
Location: Calgary, Alberta
Posts: 1,542
Maheriano will become famous soon enoughMaheriano will become famous soon enough
I'd really like some sample code. I get what you're saying but not why I should do it that way.
__________________
Ampie Case
2.5" Hard Drive 80GB Samsung 5400RPM
256 MB DDR2 PC5400
Xenarc 700TSV - VGA Monitor
Intel D945GCLF Motherboard
M2-ATX-HV

2005 Honda Civic
Maheriano is offline   Reply With Quote
Old 07-24-2009, 04:15 PM   #5
North of the land of Hey Huns
 
malcom2073's Avatar
 
Join Date: Jun 2004
Location: Westminster, MD
Posts: 1,039
malcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to allmalcom2073 is a name known to all
I must have posted 30 seconds before you. try out the above code see if that explains how to do it a bit better.
__________________
RevFE - Try it, you just might like it.
Carbon - Next Generation Touchscreen Browser
Come join us on IRC: irc.efnet.net #mp3car
Audiophiles make me chuckle as they pad my wallet.
malcom2073 is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New front end alienmanfc6 Other Cool Front Ends 3 03-30-2008 09:57 PM
New Skinnable C# .NET Front End Hessian Software & Software Development 11 12-06-2007 12:34 PM
Now a front end question? nixneon Newbie 3 06-09-2005 05:38 PM
front end question johnnywu005 Newbie 5 06-03-2005 06:13 PM
Question About a Front End for Mac OS X? bns2000 MacCar 12 11-25-2004 12:58 AM



All times are GMT -5. The time now is 01:38 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics