本文整理汇总了C#中System.Windows.Forms.DataGrid.IsExpanded方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.IsExpanded方法的具体用法?C# DataGrid.IsExpanded怎么用?C# DataGrid.IsExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGrid
的用法示例。
在下文中一共展示了DataGrid.IsExpanded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataGridPaintRelationRow
public override void DataGridPaintRelationRow (Graphics g, int row, Rectangle row_rect, bool is_newrow,
Rectangle clip, DataGrid grid)
{
Rectangle rect_header;
Rectangle icon_bounds = new Rectangle ();
Pen pen = ThemeEngine.Current.ResPool.GetPen (grid.CurrentTableStyle.ForeColor);
/* paint the header if it's visible and intersects the clip */
if (grid.CurrentTableStyle.CurrentRowHeadersVisible) {
rect_header = row_rect;
rect_header.Width = grid.RowHeaderWidth;
row_rect.X += grid.RowHeaderWidth;
if (clip.IntersectsWith (rect_header)) {
DataGridPaintRowHeader (g, rect_header, row, grid);
}
icon_bounds = rect_header;
icon_bounds.X += icon_bounds.Width / 2;
icon_bounds.Y += 3;
icon_bounds.Width = 8;
icon_bounds.Height = 8;
g.DrawRectangle (pen, icon_bounds);
/* the - part of the icon */
g.DrawLine (pen,
icon_bounds.X + 2, icon_bounds.Y + icon_bounds.Height / 2,
icon_bounds.X + icon_bounds.Width - 2, icon_bounds.Y + icon_bounds.Height / 2);
if (!grid.IsExpanded (row)) {
/* the | part of the icon */
g.DrawLine (pen,
icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + 2,
icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + icon_bounds.Height - 2);
}
}
Rectangle nested_rect = row_rect;
if (grid.DataGridRows[row].IsExpanded)
nested_rect.Height -= grid.DataGridRows[row].RelationHeight;
DataGridPaintRowContents (g, row, nested_rect, is_newrow, clip, grid);
if (grid.DataGridRows[row].IsExpanded) {
// XXX we should create this in the
// datagrid and cache it for use by
// the theme instead of doing it each
// time through here
string[] relations = grid.CurrentTableStyle.Relations;
StringBuilder relation_builder = new StringBuilder ("");
for (int i = 0; i < relations.Length; i ++) {
if (i > 0)
relation_builder.Append ("\n");
relation_builder.Append (relations[i]);
}
string relation_text = relation_builder.ToString ();
StringFormat string_format = new StringFormat ();
string_format.FormatFlags |= StringFormatFlags.NoWrap;
//Region prev_clip = g.Clip;
//Region current_clip;
Rectangle rect_cell = row_rect;
rect_cell.X = nested_rect.X + grid.GetColumnStartingPixel (grid.FirstVisibleColumn) - grid.HorizPixelOffset;
rect_cell.Y += nested_rect.Height;
rect_cell.Height = grid.DataGridRows[row].RelationHeight;
rect_cell.Width = 0;
int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount;
for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) {
if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false)
continue;
rect_cell.Width += grid.CurrentTableStyle.GridColumnStyles[column].Width;
}
rect_cell.Width = Math.Max (rect_cell.Width, grid.DataGridRows[row].relation_area.Width);
g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.BackColor),
rect_cell);
/* draw the line leading from the +/- to the relation area */
Rectangle outline = grid.DataGridRows[row].relation_area;
outline.Y = rect_cell.Y;
outline.Height --;
g.DrawLine (pen,
icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + icon_bounds.Height,
icon_bounds.X + icon_bounds.Width / 2, outline.Y + outline.Height / 2);
g.DrawLine (pen,
icon_bounds.X + icon_bounds.Width / 2, outline.Y + outline.Height / 2,
outline.X, outline.Y + outline.Height / 2);
g.DrawRectangle (pen, outline);
//.........这里部分代码省略.........