Private bool ResizeDescriptionArea(ref PropertyGrid grid, int nNumLines)
{
try
{
System.Reflection.PropertyInfo pi = grid.GetType().GetProperty("Controls");
Control.ControlCollection cc = (ControlCollection)pi.GetValue(grid, null);
foreach(Control c in cc)
{
Type ct = c.GetType();
string sName = ct.Name;
if(sName == "DocComment")
{
pi = ct.GetProperty("Lines");
pi.SetValue(c, nNumLines, null);
System.Reflection.FieldInfo fi = ct.BaseType.GetField("userSized",
System.Reflection.BindingFlags.Instance,
System.Reflection.BindingFlags.NonPublic);
fi.SetValue(c, true);
}
}
return true;
}
catch(Exception error)
{
#if(DEBUG)
MessageBox.Show(error.Message, "ResizeDescriptionArea()");
#endif
return false;
}
}
private void Form1_load(object sender, System.EventArgs e)
{ . . .
ResizeDescriptionArea(ref grid1, 6);
}
This is my technical area for troubleshooting and learning new programming skills and much more. Here, you will find answers on a wide range of technologies such as AI, Machine Learning, OpenAI, Databricks, ASP.NET, C#, Python, Microsoft Access, MySQL, Amazon Web Services, SQL Server, PL/SQL, JD Edwards, SAS, Salesforce, APIs, MVC, and many others. Please feel free to visit and join the discussion!
Showing posts with label Change the height of a PropertyGrid's description area. Show all posts
Showing posts with label Change the height of a PropertyGrid's description area. Show all posts
Wednesday, August 6, 2008
Subscribe to:
Posts (Atom)