Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
QuestionTab Pin
boiDev29-Oct-08 5:43
boiDev29-Oct-08 5:43 
AnswerRe: Tab Pin
Thomas Stockwell29-Oct-08 6:17
professionalThomas Stockwell29-Oct-08 6:17 
RantDouble Post Pin
Thomas Stockwell29-Oct-08 6:25
professionalThomas Stockwell29-Oct-08 6:25 
AnswerCP: Mark user as ABUSE Pin
leckey29-Oct-08 9:52
leckey29-Oct-08 9:52 
GeneralRe: CP: Mark user as ABUSE Pin
Paul Conrad29-Oct-08 11:05
professionalPaul Conrad29-Oct-08 11:05 
GeneralRe: CP: Mark user as ABUSE Pin
leckey29-Oct-08 13:35
leckey29-Oct-08 13:35 
AnswerRe: Tab Pin
asugix29-Oct-08 20:55
asugix29-Oct-08 20:55 
QuestionAdding controls at design time via DesignerActions [modified] Pin
Chris Copeland29-Oct-08 5:11
mveChris Copeland29-Oct-08 5:11 
Hi!

I'm part-way through making a control that utilises tab to switch between different panels. I have the code working that when the user clicks on a tab at design-time, it switches to the corresponding panel through the override WndProc in the ControlDesigner class.

I have another option though, using the DesignerActionList and DesignerActionListCollection, where I have an "Add tab" option in the Smart-tag.

In design time, it does actually add the tab. But, each tab is linked directly to a custom panel I made that should get added to the form too.
So when I click "Add tab", it invalidates my control so it writes the tab text on the top, but when I run the application it is promptly removed.
I clicked on my custom panel collection to see whether the tab is added to a collection inside the control when "Add tab" is clicked, and it is. But the problem is, it's simply not adding the control to the form's designer code.

public void AddTab()
{
    StylusOption STOpt = new StylusOption();
    int i = this.dtc.OptionTabs.Count;

    while(this.dtc.ParentForm.Controls["StyleOption" + i] != null)
        i++;

    STOpt.Name = "StyleOption" + i;

    this.dtc.ParentForm.Controls.Add(STOpt);
    this.dtc.ParentForm.CreateControl();
    this.dtc.OptionTabs.Add((StylusOption)this.dtc.ParentForm.Controls[this.dtc.ParentForm.Controls.Count - 1]);
    this.dtc.Invalidate();

    this.UIScu.HideUI(this.dtc);
}


That's the current code I have. StylusOption is the name of the control i'm trying to add, StylusBar is the control i'm adding it to, and this.dtc is the StylusBar i've set the handler to work with.

In the code, i've attempt to add the control via this.dtc.ParentForm.Controls.Add(STOpt); but even that doesn't work. I can't figure out how to add the StylusOption to the actual form to remember. If anyone can help, i'd appreciate it a lot.

An example of how i'd like it to work is like the TabControl, where if you click Add Tab, it creates a new TabPage in your form so you can edit any details there.

Thanks

modified on Wednesday, October 29, 2008 11:33 AM

AnswerRe: Adding controls at design time via DesignerActions Pin
Thomas Stockwell29-Oct-08 6:21
professionalThomas Stockwell29-Oct-08 6:21 
GeneralRe: Adding controls at design time via DesignerActions Pin
Chris Copeland29-Oct-08 10:42
mveChris Copeland29-Oct-08 10:42 
QuestionListView Column Sorting Pin
vishnukamath29-Oct-08 4:30
vishnukamath29-Oct-08 4:30 
AnswerRe: ListView Column Sorting Pin
Simon P Stevens29-Oct-08 5:07
Simon P Stevens29-Oct-08 5:07 
GeneralRe: ListView Column Sorting Pin
J4amieC29-Oct-08 5:35
J4amieC29-Oct-08 5:35 
GeneralRe: ListView Column Sorting Pin
Simon P Stevens29-Oct-08 6:32
Simon P Stevens29-Oct-08 6:32 
GeneralRe: ListView Column Sorting Pin
vishnukamath29-Oct-08 20:12
vishnukamath29-Oct-08 20:12 
QuestionMS Agent speech related Pin
Muammar©29-Oct-08 4:07
Muammar©29-Oct-08 4:07 
AnswerRe: MS Agent speech related Pin
Thomas Stockwell29-Oct-08 6:23
professionalThomas Stockwell29-Oct-08 6:23 
QuestionUnit testing for DevExpress Pin
J-Cod3r29-Oct-08 4:07
J-Cod3r29-Oct-08 4:07 
AnswerRe: Unit testing for DevExpress Pin
Kevin McFarlane29-Oct-08 5:47
Kevin McFarlane29-Oct-08 5:47 
GeneralRe: Unit testing for DevExpress Pin
J-Cod3r29-Oct-08 20:26
J-Cod3r29-Oct-08 20:26 
AnswerRe: Unit testing for DevExpress Pin
N a v a n e e t h29-Oct-08 18:35
N a v a n e e t h29-Oct-08 18:35 
AnswerRe: Unit testing for DevExpress Pin
Dennis Garavsky7-Jul-11 5:21
Dennis Garavsky7-Jul-11 5:21 
Questionxml Pin
arkiboys29-Oct-08 3:28
arkiboys29-Oct-08 3:28 
AnswerRe: xml Pin
SeMartens29-Oct-08 3:39
SeMartens29-Oct-08 3:39 
GeneralRe: xml Pin
arkiboys29-Oct-08 4:40
arkiboys29-Oct-08 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.