Example #1
0
		public override void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid)
		{
			// Background
			g.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor),
					 bounds);

			Font bold_font = new Font (grid.Font.FontFamily, grid.Font.Size, grid.Font.Style | FontStyle.Bold);
			// set up some standard string formating variables
			StringFormat text_format = new StringFormat();
			text_format.LineAlignment = StringAlignment.Center;
			text_format.Alignment = StringAlignment.Near;

			string table_name = "";
			if (row.view is DataRowView)
				table_name = ((ITypedList)((DataRowView)row.view).DataView).GetListName (null) + ": ";
			// XXX else?

			Rectangle	text_rect;
			Size		text_size;

			text_size = g.MeasureString (table_name, bold_font).ToSize();
			text_rect = new Rectangle(new Point(bounds.X + 3, bounds.Y + bounds.Height - text_size.Height), text_size);

			g.DrawString (table_name,
				      bold_font, ResPool.GetSolidBrush (grid.ParentRowsForeColor), text_rect, text_format);

			foreach (PropertyDescriptor pd in ((ICustomTypeDescriptor)row.view).GetProperties()) {
				if (typeof(IBindingList).IsAssignableFrom (pd.PropertyType))
					continue;

				text_rect.X += text_rect.Size.Width + 5;

				string text = String.Format ("{0}: {1}",
							     pd.Name,
							     pd.GetValue (row.view));

				text_rect.Size = g.MeasureString (text, grid.Font).ToSize();
				text_rect.Y = bounds.Y + bounds.Height - text_rect.Height; // XXX

				g.DrawString (text,
					      grid.Font, ResPool.GetSolidBrush (grid.ParentRowsForeColor), text_rect, text_format);
			}

            // Paint Borders
			if (!grid.FlatMode) {
                CPDrawBorder3D (g, bounds, Border3DStyle.RaisedInner, 
                    Border3DSide.Left | Border3DSide.Right | 
                    Border3DSide.Top | Border3DSide.Bottom);
			}
		}
Example #2
0
		public void NavigateTo (int rowNumber, string relationName)
		{
			if (allow_navigation == false)
				return;

			EndEdit ();

			DataGridDataSource previous_source = new DataGridDataSource (this, list_manager, datasource, datamember, list_manager.Current, CurrentCell);
			previous_source.Rows = rows;
			previous_source.SelectedRows = selected_rows;
			previous_source.SelectionStart = selection_start;

			data_source_stack.Push (previous_source);
			
			data_grid_table_style_stack.Push (CurrentTableStyle);
			grid_style_stack.Push (grid_style);
			grid_style = new DataGridTableStyle ();
			CurrentTableStyle = grid_style;

			rows = null;
			selected_rows = new Hashtable ();
			selection_start = -1;

			DataMember = String.Format ("{0}.{1}", DataMember, relationName);
			OnDataSourceChanged (EventArgs.Empty);
		}
Example #3
0
		public abstract void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid);