|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Images in a Windows DataGridI have to port a Web application to a Windows application. I've no experience of Windows apps in .NET, though I've been doing Web apps in ASP.NET since it came out. I have a normal System.Windows.Forms.DataGrid. I wish to display an image in each cell alongside some text - the image would be conditional upon the value in the cell. How can I do this in a Windows app? In the Web app I put it in the Grid_ItemDataBound event: [...] With e.Item.Cells.Item(cell) .Font.Bold = True err = GetRuleFailureDescription(startArbStatus, endArbStatus, durationArbStatus, _ IIf(hours Is DBNull.Value, 0.0, hours), ruleID) .Text = "<IMG" & _ " title=" & Chr(34) & err & Chr(34) & _ " id=" & Chr(34) & ID & "Mon" & Chr(34) & _ " runat=" & Chr(34) & "server" & Chr(34) & _ " height=" & Chr(34) & "16" & Chr(34) & _ " width=" & Chr(34) & "16" & Chr(34) & _ " src=" & Chr(34) & "../../images/incident16.gif" & Chr(34) & _ " align=" & Chr(34) & "left" & Chr(34) & _ " onclick=" & Chr(34) & "javascript:document.getElementById('txtArb').value = 'true'" & Chr(34) & _ ">" & .Text End With Thanks for any help anyone can offer. Edward teddysn***@hotmail.com wrote:
Show quoteHide quote > WINDOWS APPLICATION I am not sure of this, but perhaps you can research it.> > I have to port a Web application to a Windows application. > > I've no experience of Windows apps in .NET, though I've been doing Web > apps in ASP.NET since it came out. > > I have a normal System.Windows.Forms.DataGrid. I wish to display an > image in each cell alongside some text - the image would be conditional > upon the value in the cell. > > How can I do this in a Windows app? In the Web app I put it in the > Grid_ItemDataBound event: > > [...] > > With e.Item.Cells.Item(cell) > .Font.Bold = True > err = GetRuleFailureDescription(startArbStatus, endArbStatus, > durationArbStatus, _ > IIf(hours Is DBNull.Value, 0.0, hours), ruleID) > > .Text = "<IMG" & _ > " title=" & Chr(34) & err & Chr(34) & _ > " id=" & Chr(34) & ID & "Mon" & Chr(34) & _ > " runat=" & Chr(34) & "server" & Chr(34) & _ > " height=" & Chr(34) & "16" & Chr(34) & _ > " width=" & Chr(34) & "16" & Chr(34) & _ > " src=" & Chr(34) & "../../images/incident16.gif" & Chr(34) & _ > " align=" & Chr(34) & "left" & Chr(34) & _ > " onclick=" & Chr(34) & > "javascript:document.getElementById('txtArb').value = 'true'" & Chr(34) > & _ > ">" & .Text > End With > > Thanks for any help anyone can offer. > > Edward In a Windows DataGrid you can have TableStyles, which have DataGridColumnStyles. DatGridColumnStyle itself cannot be instanitated, but it's derivative types can. The two easily availible are DataGridTextColumn and DataGridBoolColumn. Perhaps there is one availible for images? I just starting messing with TableStyles so i'm not too familiar with it yet. B.
Alternative to using Bitmap
Really stupid looping problem Startup speed Regex Output to Textbox Urgent! Get rowindex - datagrid navigation Need to capture all keystrokes to my application Custom coordinates How to drag a form around the screen? Including a document into a project using code... How to make a "Link" REFERENCE to a project (no DLL, no file copy) |
|||||||||||||||||||||||