Click here to Skip to main content
15,885,278 members

Comments by akamper (Top 8 by date)

akamper 27-Nov-13 3:27am View    
My project is a Dialog-Designer, like the one in VisualStudio.
The properties of the controls are configurable through a property grid.
Some of these properties are using an UITypeEditor for configuration and in some cases the UITypeEditor is a modal dialog (editorFrm).
The Dialog-Designer should be the owner of this modal dialog. At the moment my problem is that the modal dialog is opened at the wrong position.
akamper 7-Mar-12 10:00am View    
Thank you. I already knew the c++ - code snipped. I thought there is a way to do the same or easier in c#.

I'm trying both, parsing the registry and convert the code ;)

Thanks again
akamper 6-Feb-12 3:11am View    
So here the code snippet:

<pre lang="c#">
[Designer(typeof(TGraphDesigner))]
[ToolboxBitmap(typeof(TGraph))]
public class TGraph : TDiagramControl // UserControl
{
public TGraph()
: base()
{
//Init....
}

protected override void OnPaint(PaintEventArgs e)
{
...
}
}



[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
public class TGraphDesigner : System.Windows.Forms.Design.ControlDesigner
{
private DesignerActionListCollection actionLists;

// Use pull model to populate smart tag menu.
public override DesignerActionListCollection ActionLists
{
get
{
if (null == actionLists)
{
actionLists = new DesignerActionListCollection();
actionLists.Add(new TGraphActionList(this.Component));
}
return actionLists;
}
}
}
public class TGraphActionList : DesignerActionList
{
private TGraph customControl;

private DesignerActionUIService designerActionUISvc = null;

//The constructor associates the control with the smart tag list.
public TGraphActionList(IComponent component)
: base(component)
{
this.customControl = component as TGraph;

// Cache a reference to DesignerActionUIService, so the DesigneractionList can be refreshed.
this.designerActionUISvc = GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
}

// Helper method to retrieve control properties. Use of GetProperties enables undo and menu updates to work properly.
private PropertyDescriptor GetPropertyByName(String propName)
{
PropertyDescriptor prop;
prop = TypeDescriptor.GetProperties(customControl)[propName];
if (null == prop)
throw new ArgumentException("Matching ColorLabel property not found!", propName);
else
return prop;
}

// Properties that are targets of DesignerActionPropertyItem entries.
public Color BackColor
{
get
{
return customControl.BackColor;
}
set
{
GetPropertyByName("BackColor").SetValue(customControl, value);
}
}

public Color ForeColor
{
get
{
return customControl.ForeColor;
}
set
{
GetPropertyByName("ForeColor").SetValue(customControl, value);
}
}


//Implementation of this abstract method creates smart tag items, associates their targets, and collects into list.
public override DesignerActionItemCollection GetSortedActionItems()
{
DesignerActionItemCollection items = new DesignerActionItemCollection();

//Define static section header entries.
items.Add(new DesignerActionHeaderItem("Appearance"));

items.Add(new DesignerActionPropertyItem("BackColor",
"Back Color", "Appearance",
"Selects the background color."));
items.Add(new DesignerActionPropertyItem("ForeColor",
"Fore Color", "Appearance",
"Selects the foreground color."));
return items;
}
}










</pre>





Nothing happens. So I cannot access designer code while debugging design time...

I hope you can help me and give me a hint, what I missed.

thanks
akamper 3-Feb-12 15:12pm View    
Thanks for your hint, but yes I did.

I will post the code on monday (not near the pc over the weekend).
akamper 19-Jan-11 7:04am View    
My "program" is a grafical designer, where the user can create his own GUI (buttons, textfields, grids.. and connect them to some input/output variables).
I'm therefore hosting the WindowsForms designer provided by the .NET Framework.

So the user should be able to drag the grid out of the Toolbox (of my designer!) and place it on the surface. Then he should be able to add columns/rows via the property grid, put some values in cells and so on. And in this design time environment, I would like that the grid already displays the grid as it would behave in runtime (and not only display the panel frame).

So more or less nearly the full runtime behaviour in design time.