Re: Draw Rectangle directly to client (ie - without bitmap?)

Tech-Archive recommends: Fix windows errors by optimizing your registry



I'm an idiot - I was calling seat.Clear earlier in the code - that fixed it.
What a dummy.

Thanks,

"NathanC" wrote:

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("seat_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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E9B4D871-5909-476F-9D90-42E78DFA4570@xxxxxxxxxxxxxxxx
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,


.



Relevant Pages

  • Re: Hotspots in graphic
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > What is the best way to draw that image on the screen? ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Hotspots in graphic
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > What is the best way to draw that image on the screen? ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Create bitmap from pBuffer
    ... Interop to GDI using StretchBlt or BitBlt will definitely be faster. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... to draw on top of the resulting bitmap. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Drawing a bitmap along a series of points: is this possible?
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... a small image that I want to draw along a path defined as a series ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Split image into seperate regions / isolation
    ... My routine scans and creates rectangles that are added to a region. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > Is there a way I can extract independent groups from the Region? ...
    (microsoft.public.dotnet.framework.drawing)