![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am trying to draw a rectangle for every record in a dataset. The drawing function will occur within a For Each loop and each record has a different XY position, so the idea is that the final result will have a single image with multiple rectangles. I have tried using bitmap methodology of doing this, but that doesn't get multiple objects on the image - only the final item is saved and displayed. Is there a way that I can draw the rectangle directly to the client, and then next iteration through the loop, draw a different rectangle in a new location without losing the last image? Thanks, |
#3
| |||
| |||
|
|
I'm assuming that your drawing to the screen and your stuff is disappearing between draw cycles. Are you respecting the laws of GetGraphics? (See the GDI+ FAQ) Perhaps you should draw your rectangles to an image in memory and then display that instead. -- -- Bob Powell [MVP] Visual C#, System.Drawing Ramuseco Limited .NET consulting http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "NathanC" <NathanC (AT) discussions (DOT) microsoft.com> wrote in message news:E9B4D871-5909-476F-9D90-42E78DFA4570 (AT) microsoft (DOT) com... I am trying to draw a rectangle for every record in a dataset. The drawing function will occur within a For Each loop and each record has a different XY position, so the idea is that the final result will have a single image with multiple rectangles. I have tried using bitmap methodology of doing this, but that doesn't get multiple objects on the image - only the final item is saved and displayed. Is there a way that I can draw the rectangle directly to the client, and then next iteration through the loop, draw a different rectangle in a new location without losing the last image? Thanks, |
#4
| |||
| |||
|
|
I'll look into that - here is my code: Dim i As Int32 For i = 0 To dvGetSeatsByScreen.Count - 1 dvGetSeatStatus.RowFilter = "id='" & dsGetSeatsByScreen.Tables("Table").Rows(i).Item("s eat_status").ToString() & "'" fore_color = dvGetSeatStatus(0)("fore_color").ToString() back_color = dvGetSeatStatus(0)("back_color").ToString() status_legend = dvGetSeatStatus(0)("status_legend").ToString() fore_color = Drawing.Color.FromArgb(fore_color) back_color = Drawing.Color.FromArgb(back_color) xpos = Convert.ToInt32(dsGetSeatsByScreen.Tables("Table") .Rows(i).Item("xpos").ToString()) ypos = Convert.ToInt32(dsGetSeatsByScreen.Tables("Table") .Rows(i).Item("xpos").ToString()) seat.DrawRectangle(Drawing.Pens.Black, xpos, ypos, 5, 10) seat.FillRectangle(Drawing.Brushes.Crimson, xpos, ypos, 5, 10) Next Response.ContentType = "image/gif" bitmap.Save("C:\Inetpub\wwwroot\Tessitura\images\" & ViewSelection.SelectedItem.Text & ".gif", Drawing.Imaging.ImageFormat.Gif) "Bob Powell [MVP]" wrote: I'm assuming that your drawing to the screen and your stuff is disappearing between draw cycles. Are you respecting the laws of GetGraphics? (See the GDI+ FAQ) Perhaps you should draw your rectangles to an image in memory and then display that instead. -- -- Bob Powell [MVP] Visual C#, System.Drawing Ramuseco Limited .NET consulting http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "NathanC" <NathanC (AT) discussions (DOT) microsoft.com> wrote in message news:E9B4D871-5909-476F-9D90-42E78DFA4570 (AT) microsoft (DOT) com... I am trying to draw a rectangle for every record in a dataset. The drawing function will occur within a For Each loop and each record has a different XY position, so the idea is that the final result will have a single image with multiple rectangles. I have tried using bitmap methodology of doing this, but that doesn't get multiple objects on the image - only the final item is saved and displayed. Is there a way that I can draw the rectangle directly to the client, and then next iteration through the loop, draw a different rectangle in a new location without losing the last image? Thanks, |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |