AlexS
2007-06-03 14:53:29 UTC
Maybe I am missing something simple, but I am getting internal exception in
FW 2.0/3.0 when setting data source for a grid to data table, which contains
binary data. Looks like grid wants to paint them as image and throws
exception when data are not image - see stack below (not complete).
How can I avoid this? At least ignore?
Is there some settings which tells grid to ignore such errors? I can't find
it.
I am handling DataError event, but it doesn't get called.
Any suggestions?
System.Drawing.dll!System.Drawing.Image.FromStream(System.IO.Stream
stream, bool useEmbeddedColorManagement, bool validateImageData) + 0x1a6
bytes
System.Drawing.dll!System.Drawing.ImageConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext
context, System.Globalization.CultureInfo culture, object value) + 0x89
bytes
System.Windows.Forms.dll!System.Windows.Forms.Formatter.FormatObjectInternal(object
value, System.Type targetType, System.ComponentModel.TypeConverter
sourceConverter, System.ComponentModel.TypeConverter targetConverter, string
formatString, System.IFormatProvider formatInfo, object formattedNullValue)
+ 0x2d5 bytes
System.Windows.Forms.dll!System.Windows.Forms.Formatter.FormatObject(object
value = {Dimensions:[256]}, System.Type targetType = {System.Drawing.Image},
System.ComponentModel.TypeConverter sourceConverter,
System.ComponentModel.TypeConverter targetConverter, string formatString,
System.IFormatProvider formatInfo, object formattedNullValue, object
dataSourceNullValue) + 0x77 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.GetFormattedValue(object
value, int rowIndex = 0, ref System.Windows.Forms.DataGridViewCellStyle
cellStyle = {DataGridViewCellStyle { BackColor=Color [Window],
ForeColor=Color [ControlText], SelectionBackColor=Color [Highlight],
SelectionForeColor=Color [HighlightText], Font=[Font: Name=Microsoft Sans
Serif, Size=8.25, Units=3, GdiCharSet=204, GdiVerticalFont=False],
NullValue=System.Drawing.Bitmap, WrapMode=False, Alignment=MiddleCenter }},
System.ComponentModel.TypeConverter valueTypeConverter,
System.ComponentModel.TypeConverter formattedValueTypeConverter,
System.Windows.Forms.DataGridViewDataErrorContexts context = Formatting |
Display) + 0x138 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewImageCell.GetFormattedValue(object
value, int rowIndex, ref System.Windows.Forms.DataGridViewCellStyle
cellStyle = {DataGridViewCellStyle { BackColor=Color [Window],
ForeColor=Color [ControlText], SelectionBackColor=Color [Highlight],
SelectionForeColor=Color [HighlightText], Font=[Font: Name=Microsoft Sans
Serif, Size=8.25, Units=3, GdiCharSet=204, GdiVerticalFont=False],
NullValue=System.Drawing.Bitmap, WrapMode=False, Alignment=MiddleCenter }},
System.ComponentModel.TypeConverter valueTypeConverter,
System.ComponentModel.TypeConverter formattedValueTypeConverter,
System.Windows.Forms.DataGridViewDataErrorContexts context) + 0x34 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.GetEditedFormattedValue(object
value, int rowIndex, ref System.Windows.Forms.DataGridViewCellStyle
dataGridViewCellStyle, System.Windows.Forms.DataGridViewDataErrorContexts
context) + 0xc9 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.PaintWork(System.Drawing.Graphics
graphics = {System.Drawing.Graphics}, System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle cellBounds, int rowIndex = 0,
System.Windows.Forms.DataGridViewElementStates cellState = Displayed |
Selected | Visible, System.Windows.Forms.DataGridViewCellStyle cellStyle,
System.Windows.Forms.DataGridViewAdvancedBorderStyle advancedBorderStyle =
{DataGridViewAdvancedBorderStyle { All=NotSet, Left=None, Right=Single,
Top=None, Bottom=Single }}, System.Windows.Forms.DataGridViewPaintParts
paintParts = All) + 0x63 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.PaintCells(System.Drawing.Graphics
graphics = {System.Drawing.Graphics}, System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle rowBounds, int rowIndex = 0,
System.Windows.Forms.DataGridViewElementStates rowState = Displayed |
Visible, bool isFirstDisplayedRow = true, bool isLastVisibleRow,
System.Windows.Forms.DataGridViewPaintParts paintParts = All) + 0x532 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.Paint(System.Drawing.Graphics
graphics = {System.Drawing.Graphics}, System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle rowBounds, int rowIndex = 0,
System.Windows.Forms.DataGridViewElementStates rowState = Displayed |
Visible, bool isFirstDisplayedRow = true, bool isLastVisibleRow = true) +
0x17a bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridView.PaintRows(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle boundingRect,
System.Drawing.Rectangle clipRect, bool singleHorizontalBorderAdded = false)
+ 0x38a bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridView.PaintGrid(System.Drawing.Graphics
g, System.Drawing.Rectangle gridBounds, System.Drawing.Rectangle clipRect,
bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded) + 0x2b9
bytes
FW 2.0/3.0 when setting data source for a grid to data table, which contains
binary data. Looks like grid wants to paint them as image and throws
exception when data are not image - see stack below (not complete).
How can I avoid this? At least ignore?
Is there some settings which tells grid to ignore such errors? I can't find
it.
I am handling DataError event, but it doesn't get called.
Any suggestions?
System.Drawing.dll!System.Drawing.Image.FromStream(System.IO.Stream
stream, bool useEmbeddedColorManagement, bool validateImageData) + 0x1a6
bytes
System.Drawing.dll!System.Drawing.ImageConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext
context, System.Globalization.CultureInfo culture, object value) + 0x89
bytes
System.Windows.Forms.dll!System.Windows.Forms.Formatter.FormatObjectInternal(object
value, System.Type targetType, System.ComponentModel.TypeConverter
sourceConverter, System.ComponentModel.TypeConverter targetConverter, string
formatString, System.IFormatProvider formatInfo, object formattedNullValue)
+ 0x2d5 bytes
System.Windows.Forms.dll!System.Windows.Forms.Formatter.FormatObject(object
value = {Dimensions:[256]}, System.Type targetType = {System.Drawing.Image},
System.ComponentModel.TypeConverter sourceConverter,
System.ComponentModel.TypeConverter targetConverter, string formatString,
System.IFormatProvider formatInfo, object formattedNullValue, object
dataSourceNullValue) + 0x77 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.GetFormattedValue(object
value, int rowIndex = 0, ref System.Windows.Forms.DataGridViewCellStyle
cellStyle = {DataGridViewCellStyle { BackColor=Color [Window],
ForeColor=Color [ControlText], SelectionBackColor=Color [Highlight],
SelectionForeColor=Color [HighlightText], Font=[Font: Name=Microsoft Sans
Serif, Size=8.25, Units=3, GdiCharSet=204, GdiVerticalFont=False],
NullValue=System.Drawing.Bitmap, WrapMode=False, Alignment=MiddleCenter }},
System.ComponentModel.TypeConverter valueTypeConverter,
System.ComponentModel.TypeConverter formattedValueTypeConverter,
System.Windows.Forms.DataGridViewDataErrorContexts context = Formatting |
Display) + 0x138 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewImageCell.GetFormattedValue(object
value, int rowIndex, ref System.Windows.Forms.DataGridViewCellStyle
cellStyle = {DataGridViewCellStyle { BackColor=Color [Window],
ForeColor=Color [ControlText], SelectionBackColor=Color [Highlight],
SelectionForeColor=Color [HighlightText], Font=[Font: Name=Microsoft Sans
Serif, Size=8.25, Units=3, GdiCharSet=204, GdiVerticalFont=False],
NullValue=System.Drawing.Bitmap, WrapMode=False, Alignment=MiddleCenter }},
System.ComponentModel.TypeConverter valueTypeConverter,
System.ComponentModel.TypeConverter formattedValueTypeConverter,
System.Windows.Forms.DataGridViewDataErrorContexts context) + 0x34 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.GetEditedFormattedValue(object
value, int rowIndex, ref System.Windows.Forms.DataGridViewCellStyle
dataGridViewCellStyle, System.Windows.Forms.DataGridViewDataErrorContexts
context) + 0xc9 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.PaintWork(System.Drawing.Graphics
graphics = {System.Drawing.Graphics}, System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle cellBounds, int rowIndex = 0,
System.Windows.Forms.DataGridViewElementStates cellState = Displayed |
Selected | Visible, System.Windows.Forms.DataGridViewCellStyle cellStyle,
System.Windows.Forms.DataGridViewAdvancedBorderStyle advancedBorderStyle =
{DataGridViewAdvancedBorderStyle { All=NotSet, Left=None, Right=Single,
Top=None, Bottom=Single }}, System.Windows.Forms.DataGridViewPaintParts
paintParts = All) + 0x63 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.PaintCells(System.Drawing.Graphics
graphics = {System.Drawing.Graphics}, System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle rowBounds, int rowIndex = 0,
System.Windows.Forms.DataGridViewElementStates rowState = Displayed |
Visible, bool isFirstDisplayedRow = true, bool isLastVisibleRow,
System.Windows.Forms.DataGridViewPaintParts paintParts = All) + 0x532 bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.Paint(System.Drawing.Graphics
graphics = {System.Drawing.Graphics}, System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle rowBounds, int rowIndex = 0,
System.Windows.Forms.DataGridViewElementStates rowState = Displayed |
Visible, bool isFirstDisplayedRow = true, bool isLastVisibleRow = true) +
0x17a bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridView.PaintRows(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle boundingRect,
System.Drawing.Rectangle clipRect, bool singleHorizontalBorderAdded = false)
+ 0x38a bytes
System.Windows.Forms.dll!System.Windows.Forms.DataGridView.PaintGrid(System.Drawing.Graphics
g, System.Drawing.Rectangle gridBounds, System.Drawing.Rectangle clipRect,
bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded) + 0x2b9
bytes