samiullah478 Posted December 21, 2006 Posted December 21, 2006 how to change themes for controls in vb fourm and assign a new window theme ? that is used in window xp. like i want to set default window xp classic theme. secondly i want to use a same datagrid view i generated in one form in to others forms with same parameters. is it i make it class ? how to convert it in custom tool Quote
mskeel Posted December 21, 2006 Posted December 21, 2006 Generally, it is considered most polite to use whatever theme the user has selected. The exception being if you are looking to skin your application (like windows media player). This thread might be a little old but it has some good information in it that will help get you on the right track. Also, just for future reference, you will have more success with getting questions answered if you only ask one question in a thread at a time. Welcome to the forums! Quote
*Experts* Nerseus Posted December 21, 2006 *Experts* Posted December 21, 2006 For your datagridview question - you have lots of options, but two come to mind. Which one you use depends on how you've created the control. 1. Create a new class that inherits from DataGridView. Copy the code from your form's InitializeComponent that sets the properties for the DataGridView into the constructor of the new class. Then, use your new class instead of DataGridView. Your new class is a DataGridView so all code works exactly the same - you're just specifying some defaults for the properties. 2. If you create the control manually (not through the designer), then move that code into another class that returns the instance through a static method (the factor pattern). For example, if you have code on your form like the following: private void SetupForm() { DataGridView gv = new DataGridView(); // Set properties of gv here... // Add the DataGridView to the form this.Controls.Add(gv); } Then you'll want something like this: // Code in a new class internal class DataGridViewUtility internal static DataGridView CreateDefault() { DataGridView gv = new DataGridView(); // Set properties of gv here... // Add the DataGridView to the form return gv; } // Then in your form: private void SetupForm() { // Add the DataGridView to the form this.Controls.Add(DataGridViewUtility.CreateDefault()); } -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.