Windows Develop Bookmark and Share   
 index > Windows Forms General > Forcing a component to use default colors
 

Forcing a component to use default colors

I have a component that I've written for the gridview that sets the grid up using default colors and such that I want to use throughout the application. The thought was also that later, if I wanted to change the colors I could modify my component and flush those changes down through all the forms that used it.

However, I've noticed that once the component is dropped onto a form, all the default functions are gone. They setup correctly the moment it was dropped but if I wanted to change the component for say the default header color, it will drop onto a new form correctly but all those old grids I dropped won't update. They keep their default values from the first day I dropped them.

Can anyone suggest a way to deal with this to get the functionality that I'm looking for?

Thanks,

glenn

cybercrypt13  Sunday, April 01, 2007 1:18 PM

Unfortunately, the IDE will still see your modifications as manual changes and it will create entries in the InitialComponents(). If you remove these related entries it should give you back your custom settings.

To actually propagate these changes, you will need to define properties corresponding to the datagrid properties that you want to customize.

JRQ  Monday, April 02, 2007 8:33 PM
You're not saying what you did in your component to change the default colors. I'm guessing that you didn't override the set accessor, just the default value with the constructor. The color is now controlled by the code in InitializeComponent().
nobugz  Monday, April 02, 2007 8:23 AM

Yes, I have the code in the components constructor... Should I have put it somewhere else?

Thanks,

glenn

cybercrypt13  Monday, April 02, 2007 7:57 PM

Unfortunately, the IDE will still see your modifications as manual changes and it will create entries in the InitialComponents(). If you remove these related entries it should give you back your custom settings.

To actually propagate these changes, you will need to define properties corresponding to the datagrid properties that you want to customize.

JRQ  Monday, April 02, 2007 8:33 PM

You can use google to search for other answers

Custom Search

More Threads

• using cursors as images of buttons
• TabControl: How do you turn off it's Left/Right cursor functionality?
• Help with Making ListView Columns Sortable in VC++ 2005
• DataGridView format part of a cell's text
• TreeView OwnerDraw Issue
• trapping focus to a control
• 'Jumpy' scroll in RichTextBox...
• How to get Continuous Smooth Progress Bar in Windows Application
• any idea how to get the 1st icon from an exe -file?
• MDI childs and parents