I have a grid where I created an unbound column for Formatted text and made it multiline. Each row is at least 2 lines in heigh but I added another column that is an image and when I put an image in it shrinks it dow so it woudl fit if the row was not multi line height. Is there any way to get this to size properly. The only way to seem to get a bigger image I have found is to set the background image property and set the style ot stretched but I would rather have the image be its normal size so there is a little border around it in the cell.
grdResults.DisplayLayout.Bands(0).Columns.Add("MatchTypeIcon") grdResults.DisplayLayout.Bands(0).Columns("MatchTypeIcon").Header.Caption = "" grdResults.DisplayLayout.Bands(0).Columns("MatchTypeIcon").Header.VisiblePosition = 2 grdResults.DisplayLayout.Bands(0).Columns("MatchTypeIcon").Header.Appearance.ImageHAlign = HAlign.Center grdResults.DisplayLayout.Bands(0).Columns("MatchTypeIcon").Header.Appearance.ImageVAlign = VAlign.Middle grdResults.DisplayLayout.Bands(0).Columns("MatchTypeIcon").DataType = GetType(System.Drawing.Bitmap) grdResults.DisplayLayout.Bands(0).Columns("MatchTypeIcon").Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Image
Private Sub grdResults_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles grdResults.InitializeLayout
grdResults.UseAppStyling = False grdResults.UseOsThemes = DefaultableBoolean.False grdResults.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.White grdResults.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.Black grdResults.DisplayLayout.Override.ActiveRowAppearance.BorderColor = Color.Black grdResults.DisplayLayout.Override.ActiveRowAppearance.BorderAlpha = Alpha.Opaque grdResults.DisplayLayout.Override.HeaderAppearance.BackColor = Color.Transparent 'FromArgb(210, 226, 223) grdResults.DisplayLayout.Override.HeaderAppearance.BackGradientStyle = GradientStyle.None grdResults.DisplayLayout.Override.HeaderAppearance.BorderAlpha = Alpha.Opaque grdResults.DisplayLayout.Override.BorderStyleCell = UIElementBorderStyle.None grdResults.DisplayLayout.Override.RowAppearance.BorderColor = Color.Teal grdResults.DisplayLayout.Appearance.BackColor = Color.Transparent grdResults.DisplayLayout.Appearance.BorderAlpha = Alpha.Transparent grdResults.DisplayLayout.Override.RowAppearance.BackColor = Color.Transparent grdResults.DisplayLayout.Override.DefaultRowHeight = 40
grdResults.DisplayLayout.ViewStyleBand = ViewStyleBand.Vertical grdResults.DisplayLayout.Bands(0).ColHeadersVisible = False
grdResults.DisplayLayout.Override.CellAppearance.TextVAlign = VAlign.Middle grdResults.DisplayLayout.Override.RowSizing = RowSizing.AutoFixed
'e.Layout.AutoFitStyle = AutoFitStyle.ExtendLastColumn
For Each ugc As UltraGridColumn In grdResults.DisplayLayout.Bands(0).Columns If ugc.Key <> "DisplayMatch" And ugc.Key <> "MatchTypeIcon" And ugc.Key <> "DisplayMatchNumber" Then 'AndAlso ugc.Key <> "Yprevbal" AndAlso ugc.Key <> "PastDueBalance" 'AndAlso ugc.Key <> "TaxPropertyMasterId" Then ugc.Hidden = True ElseIf ugc.Key = "DisplayMatch" Then ugc.Width = grdResults.Width - 180 ElseIf ugc.Key = "DisplayMatchTypeIcon" Then ugc.Width = grdResults.Width - 40 End If ugc.CellActivation = Activation.NoEdit Next
End Sub
Private Sub grdResults_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles grdResults.InitializeRow Dim strDisplay As String Dim strNumberDisplay As String
strDisplay = "<p><font color=""#393B87""><font size=""+1"">" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(CStr(e.Row.Cells("Name").Value), VbStrConv.ProperCase)) + "</font></font></p>"
strDisplay = strDisplay + " " + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(e.Row.Cells("Address1").Value, VbStrConv.ProperCase))
'strDisplay = strDisplay + "<p align=""right"">Number " + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(e.Row.Cells("AccountNumber").Value, VbStrConv.ProperCase)) + "</p>" strDisplay = strDisplay.Replace(StrConv(_searchFileter, VbStrConv.ProperCase), "<b>" + StrConv(_searchFileter, VbStrConv.ProperCase) + "</b>") 'strDisplay = Microsoft.VisualBasic.Strings.Replace(strDisplay, _searchFileter, "<b>" + _searchFileter + "</b>", 1, -1, Constants.vbTextCompare)
strNumberDisplay = "<p align=""right"">Number " + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(e.Row.Cells("AccountNumber").Value, VbStrConv.ProperCase)) + "</p>" strNumberDisplay = strNumberDisplay.Replace(StrConv(_searchFileter, VbStrConv.ProperCase), "<b>" + StrConv(_searchFileter, VbStrConv.ProperCase) + "</b>")
e.Row.Cells("DisplayMatch").Value = strDisplay e.Row.Cells("DisplayMatchNumber").Value = strNumberDisplay e.Row.Cells("MatchTypeIcon").Value = CsiImageResources.CsiImageList.Images(37)
'e.Row.Cells("MatchTypeIcon").Appearance.ImageBackground = CsiImageResources.CsiImageList.Images(37) 'e.Row.Cells("MatchTypeIcon").Appearance.ImageBackgroundStyle = ImageBackgroundStyle.Stretched
Hi,
The grid cells will always shrink images down to fit the cell. So the way to handle this is to increase the height of the row so that there is enough room for the image.
You will need to set the height of the row explicitly, though. there's no way to autosize it. So I would set e.Row.Height to something like the height of the image plus 4 (to account for the borders).
That is what I was thinking but I set my defaultrowheight property to 40 and when I look at the height of the row in code on the initializeRow event it is 40 but the image is sized to about half that height