
A problem about the PropertyGrid.
I created a propertygrid in one of my dll.
And I pass it as a "Control" to my main application.
It belongs to a panel in main application.
But when the form showing, the propertygrid had a little different:
all of it's head title and item's caption disappeared.
It had a terrible look.
Some of my code shown as follows:
public class DllTest
{
PropertyGrid gridRight;
...........
public override void CreateControl()
{
// Right
gridRight = new System.Windows.Forms.PropertyGrid();
gridRight.Location = new System.Drawing.Point(216, 0);
// Create properties tab
gridRight.CommandsVisibleIfAvailable = true;
gridRight.LargeButtons = false;
gridRight.LineColor = System.Drawing.SystemColors.ScrollBar;
gridRight.Location = new System.Drawing.Point(16, 8);
gridRight.Name = "propertyGrid1";
gridRight.Size = new System.Drawing.Size(256, 248);
gridRight.ViewBackColor = System.Drawing.SystemColors.Window;
gridRight.ViewForeColor = System.Drawing.SystemColors.WindowText;
gridRight.Text = "PropertyGrid";
gridRight.Dock = System.Windows.Forms.DockStyle.Fill;
gridRight.TabIndex = 1;
}
............
public override Control Right
{
get
{
return gridRight;
}
}
............
private void treeViewLeft_Clicked(object sender, TreeViewCancelEventArgs
e)
{
if (null != e.Node.Tag)
gridRight.SelectedObject = e.Node.Tag as BackupItem;
else
gridRight.SelectedObject = null;
}
............
Quote:
}
public class MainApplication
{
private void LoadClientComponents()
{
middleBar = new Splitter();
middleBar.Dock = DockStyle.Left;
panelRight.Controls.Add(middleBar);
intee.Initialize(); // intee is an instance of DllTest
and is created in another place.
intee.CreateControl();
left = intee.Left;
panelRight.Controls.Add(intee.Left);
right = intee.Right;
panelRight.Controls.Add(intee.Right);
}
Quote:
}
Thanks for your advice!