Ask a Question related to ASP.NET General, Design and Development.
-
Alvin Bruney #1
Re: How can I draw a picture to a web form dynamically.
you will need something like an image placeholder in your client form. then
you can load your gif file into that place holder.
//Add the image into the placeholder.
string strImageTag = "<IMG SRC='" + strRelativePath + "'/>";
ChartHolder.Controls.Add(new LiteralControl(strImageTag));
hth
"Steve" <horsfall@cmmts.com> wrote in message
news:09a001c34fa3$923905e0$a501280a@phx.gbl...> I would like to programmatically build a picture in memory
> and the assign it to an image on a web form when the form
> is loaded. I built the image in memory but could not see a
> way to assign it to the image. GDI failed when I tried to
> save it temporarly to the server. Thanks.
Alvin Bruney Guest
-
Dynamically Adding Form Fields to CF Flash Form
I think I know the answer to this but, after some failed Googles, I wanted to double-check here. I have a Flash-based event registration form I'm... -
Draw a circle/rectangle dynamically
I want to draw a rectangle or circle dynamically and fill it with the gradient color. Any examples (codes) ? thanks a lot. Derek -
MX : 10.3 "Cannot Draw Picture - Not Enough Memory"
Have installed fix patch for activation, but FH continues to crash, not open when dblclicked and worst of all, will not re-draw, not enough memory!... -
Could not draw picture
I've got a similar problem. If you've found an answer, please contact me at allisond@si.edu. Thanks! -- Posted via http://dbforums.com -
Move around a picture file dynamically in an asp page.
How to move around a picture file dynamically in an asp page? Any link to sample code will be great. Thanks. *** Sent via Developersdex... -
Steve #2
Re: How can I draw a picture to a web form dynamically.
I still can't figure out how the image I am drawing gets
into the image on the web form. It seems like you assume I
already have an image. The real problem here is that the
bmp.Save(....) method raises a GDI error under a web
application which works in a windows one. Or it is
entirely possible that I don't fully understand your
previous post. If this is the case please give me further
information to help me understand this. Thanks for your
trouble.
client form. then>-----Original Message-----
>you will need something like an image placeholder in your+ "'/>";>you can load your gif file into that place holder.
>
>//Add the image into the placeholder.
>
>string strImageTag = "<IMG SRC='" + strRelativePathmemory>
>ChartHolder.Controls.Add(new LiteralControl(strImageTag));
>
>hth
>
>"Steve" <horsfall@cmmts.com> wrote in message
>news:09a001c34fa3$923905e0$a501280a@phx.gbl...>> I would like to programmatically build a picture inform>> and the assign it to an image on a web form when thesee a>> is loaded. I built the image in memory but could notto>> way to assign it to the image. GDI failed when I tried>>> save it temporarly to the server. Thanks.
>
>.
>Steve Guest
-
Neil Kimber #3
Re: How can I draw a picture to a web form dynamically.
GDI error is because the ASP.Net worker process does not have permission to
write your image to a file.
You can stream images to the browser from RAM without the use of files. This
works in the following way. You have a webpage that includes an image. The
image path points to another ASP.Net webpage (Image Page). The Image Page
draws the image in RAM and then streams the final image to the browser. It
acheives this by doing something like:
this.Context.Response.Clear();
this.Context.Response.ContentType="Image/Jpeg";
MyBitmap.Save(this.Context.Response.OutputStream, ImageFormat.Jpeg);
this.Context.Response.End();
This essentially alters the response to a standard ASP.Net webpage and turns
the response into a streamed image. You still need to draw on your Bitmap
(obviously)
Hope this helps,
Neil
"Steve" <horsfall@cmmts.com> wrote in message
news:021401c34fa7$a7199430$a101280a@phx.gbl...> I still can't figure out how the image I am drawing gets
> into the image on the web form. It seems like you assume I
> already have an image. The real problem here is that the
> bmp.Save(....) method raises a GDI error under a web
> application which works in a windows one. Or it is
> entirely possible that I don't fully understand your
> previous post. If this is the case please give me further
> information to help me understand this. Thanks for your
> trouble.
>> client form. then> >-----Original Message-----
> >you will need something like an image placeholder in your> + "'/>";> >you can load your gif file into that place holder.
> >
> >//Add the image into the placeholder.
> >
> >string strImageTag = "<IMG SRC='" + strRelativePath> memory> >
> >ChartHolder.Controls.Add(new LiteralControl(strImageTag));
> >
> >hth
> >
> >"Steve" <horsfall@cmmts.com> wrote in message
> >news:09a001c34fa3$923905e0$a501280a@phx.gbl...> >> I would like to programmatically build a picture in> form> >> and the assign it to an image on a web form when the> see a> >> is loaded. I built the image in memory but could not> to> >> way to assign it to the image. GDI failed when I tried> >> >> save it temporarly to the server. Thanks.
> >
> >.
> >
Neil Kimber Guest
-
vMike #4
Re: How can I draw a picture to a web form dynamically.
You can use someting I created see below. You set the image src to aspx file
like
pic.aspx?imagename.ext?_w=100&_h=100&_q=1 (or 2)
In the pic.aspx file do something like the following. will need the
System.Drawing and System.Drawing.Imaging and System.Drawing.Drawing2D
namespaces. You will have to adjust somethings for you particular situation.
sub Page_Load(sender as object, e as eventArgs)
dim strPic as string = request.querystring("_p")
dim intWidth as integer = request.querystring("_w")
dim intHeight as integer = request.querystring("_h")
dim intQuality as integer = request.querystring("_q")
dim myNewImage as system.drawing.image
dim strFileLoc as string = "your path to your pictures"
try
select case intQuality
case is = 1
if intWidth = 0 then intWidth = 200
if intHeight = 0 then intHeight = 200
mynewimage = mgAdjustBitmap(strFileLoc & strPic, intWidth,
intHeight)
case else
if intWidth = 0 then intWidth = 90
if intHeight = 0 then intHeight = 90
mynewimage = mggetthumbnail(strFileLoc & strPic,intWidth,intHeight)
end select
mynewimage.Save(Response.OutputStream, ImageFormat.Jpeg)
catch
mynewimage= mggetthumbnail(strFileLoc & "npicture.jpg",90,90)
mynewimage.Save(Response.OutputStream, ImageFormat.Jpeg)
end try
End Sub
Function mgGetThumbNail(strFile as string, intWidth as integer, intHeight as
integer) as system.drawing.image
Dim myBitmap As bitmap = New Bitmap(strFile)
return mybitmap.getthumbnailimage(intWidth,intHeight,noth ing,nothing)
mybitmap.dispose
End Function
Function mgAdjustBitmap(strFile as string, intHorz as integer, intVert as
integer) as bitmap
Dim mysize as size = new size(inthorz,intVert)
Dim myBitmap As bitmap = New Bitmap(strFile)
dim myImg as bitmap = new bitmap(mybitmap, mysize)
return myImg
mybitmap.dispose
End Function
"Steve" <horsfall@cmmts.com> wrote in message
news:09a001c34fa3$923905e0$a501280a@phx.gbl...> I would like to programmatically build a picture in memory
> and the assign it to an image on a web form when the form
> is loaded. I built the image in memory but could not see a
> way to assign it to the image. GDI failed when I tried to
> save it temporarly to the server. Thanks.
vMike Guest



Reply With Quote

