Click here to Skip to main content
15,925,528 members
Home / Discussions / C#
   

C#

 
GeneralRe: Adding and Removing Form Controls Programatically Pin
Joseph Stanish21-May-07 4:39
Joseph Stanish21-May-07 4:39 
GeneralRe: Adding and Removing Form Controls Programatically Pin
Martin#21-May-07 4:45
Martin#21-May-07 4:45 
GeneralRe: Adding and Removing Form Controls Programatically Pin
Marc Clifton21-May-07 5:05
mvaMarc Clifton21-May-07 5:05 
QuestionChange Locked property Pin
Tushar Mahajan21-May-07 3:17
Tushar Mahajan21-May-07 3:17 
AnswerRe: Change Locked property Pin
Manoj Kumar Rai21-May-07 3:38
professionalManoj Kumar Rai21-May-07 3:38 
GeneralRe: Change Locked property Pin
Tushar Mahajan21-May-07 3:46
Tushar Mahajan21-May-07 3:46 
GeneralRe: Change Locked property Pin
Martin#21-May-07 4:33
Martin#21-May-07 4:33 
GeneralRe: Change Locked property Pin
Tushar Mahajan21-May-07 18:55
Tushar Mahajan21-May-07 18:55 
Hi Martin,

I am having the list like shown below,list of custom buttons,user can add the buttons to my user control from property editor, i have exposed public property from user control.


public TabsPagesList TabPagesList
{
get
{
return _tabPagesList;
}
set
{
if (value != null)
{
_tabPagesList.Add(value);
}
}
}

[DesignTimeVisible(true)]
public class TabsPagesList : CollectionBase
{
public delegate void CustomButtonAdded(CustomButton newTextBox);
public delegate void CustomButtonRemoved(CustomButton newCustomButton);

public event CustomButtonAdded OnCustomButtonAdded;
public event CustomButtonRemoved OnCustomButtonRemoved;


public TabsPagesList()
{
}

public CustomButton this[int index]
{
get
{
return (CustomButton)List[index];
}
set
{
List[index] = (CustomButton)value;
}
}

public void AddCustomButton(CustomButton lb)
{
List.Add((CustomButton)lb);
//base.InnerList.Add(lb);
}

public void Add(TabsPagesList list)
{
base.InnerList.AddRange(list);
}

public bool Contains(CustomButton customButton)
{
return List.Contains(customButton);
}



protected override void OnInsert(int index, object value)
{
base.OnInsert(index, value);
}

protected override void OnInsertComplete(int index, object value)
{
base.OnInsertComplete(index, value);
if (OnCustomButtonAdded != null)
OnCustomButtonAdded((CustomButton)value);
}

protected override void OnRemove(int index, object value)
{
MessageBox.Show("OnRemoveComplete");
if (OnCustomButtonRemoved != null)
{
MessageBox.Show("calling OnCustomButtonRemoved");
OnCustomButtonRemoved((CustomButton)value);
}

base.OnRemove(index, value);
}

protected override void OnRemoveComplete(int index, object value)
{
base.OnRemoveComplete(index, value);

MessageBox.Show("OnRemoveComplete");
if (OnCustomButtonRemoved != null)
{
MessageBox.Show("calling OnCustomButtonRemoved");
OnCustomButtonRemoved((CustomButton)value);
}
}
}

public class CustomButton : Button
{
private ArrayList childControls;
private bool isSelected;
private int _leftPos;

public delegate void CustomButtonMouseDown(MouseEventArgs e);

public event CustomButtonMouseDown OnCustomButtonMouseDown;

public CustomButton()
{
childControls = new ArrayList();
//Load three images here
}

public int LeftPos
{
get
{
return _leftPos;
}
set
{
_leftPos = value;
}
}

protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
}

protected override void OnMouseDown(MouseEventArgs e)
{
MessageBox.Show("Inside Button class MouseDown");
base.OnMouseDown(e);
if (OnCustomButtonMouseDown != null)
OnCustomButtonMouseDown(e);
}

public bool IsSelected
{
get
{
return isSelected;
}
set
{
isSelected = value;
}
}

public void AddControl(Control cntrl)
{
childControls.Add(cntrl);
}

public ArrayList InnerControls
{
get
{
return childControls;
}
}
}


Thanks,
Tushar
AnswerRe: Change Locked property Pin
Martin#21-May-07 3:41
Martin#21-May-07 3:41 
QuestionApplication Error---Any help please?? Pin
Ntoki21-May-07 2:55
Ntoki21-May-07 2:55 
AnswerRe: Application Error---Any help please?? Pin
Guffa21-May-07 3:00
Guffa21-May-07 3:00 
QuestionHow to send Date as a DateTime Object?. Pin
pubududilena21-May-07 2:51
pubududilena21-May-07 2:51 
AnswerRe: How to send Date as a DateTime Object?. Pin
Manoj Kumar Rai21-May-07 3:00
professionalManoj Kumar Rai21-May-07 3:00 
GeneralRe: How to send Date as a DateTime Object?. Pin
pubududilena21-May-07 3:14
pubududilena21-May-07 3:14 
GeneralRe: How to send Date as a DateTime Object?. Pin
Manoj Kumar Rai21-May-07 3:26
professionalManoj Kumar Rai21-May-07 3:26 
GeneralRe: How to send Date as a DateTime Object?. Pin
pubududilena21-May-07 3:39
pubududilena21-May-07 3:39 
AnswerRe: How to send Date as a DateTime Object?. Pin
DoomedOne21-May-07 11:34
DoomedOne21-May-07 11:34 
QuestionInterface question Pin
groundzero11121-May-07 1:58
groundzero11121-May-07 1:58 
AnswerRe: Interface question Pin
Pete O'Hanlon21-May-07 2:12
mvePete O'Hanlon21-May-07 2:12 
AnswerRe: Interface question [modified] Pin
Dave Herren21-May-07 3:21
Dave Herren21-May-07 3:21 
GeneralRe: Interface question Pin
groundzero11121-May-07 6:43
groundzero11121-May-07 6:43 
QuestionDataGrid Cell Merging Pin
rujuc#21-May-07 1:56
rujuc#21-May-07 1:56 
QuestionDigital Persona Pin
| Muhammad Waqas Butt |21-May-07 1:19
professional| Muhammad Waqas Butt |21-May-07 1:19 
AnswerRe: Digital Persona Pin
Dave Kreskowiak21-May-07 6:35
mveDave Kreskowiak21-May-07 6:35 
QuestionDataSet Query Pin
Blumen21-May-07 0:38
Blumen21-May-07 0:38 

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.