Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Help with creating a control that generates dynamic image

Reply
Thread Tools

Help with creating a control that generates dynamic image

 
 
Dave Slinn
Guest
Posts: n/a
 
      12-13-2005
I am using various System.Drawing classes to create a graphic at runtime,
with the resulting image varied based on some properties the user may have
set.

Currently I have the graphic being saved to the file system (in a subfolder
of the web app) and then my web control renders a src attrobute to this
graphic file (.png), which works ok at runtime, but this mechanism doesn't
seem to work when viewing the control at design time in Visual Studio. I
did create this control in a Web Control Library project, and referenced the
assembly through my Toolbox, and can now drag and drop instances from there,
but the image displayed on the visual studio designer appears as a broken
graphic (the square with the red X in it).

How can I get the graphic to display properly at design time - can write the
graphic to the Response.OutputStream instead of saving it to the file
system? Any web articles or source code samples pointing me in the write
direction of creating an ASP.NET control that generates an image using the
GDI+ stuff would be most appreciated.

- Dave Slinn


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-13-2005
Hi Dave,

Welcome to ASPNET newsgroup.
Regarding on the creating custom image generation webcontrol problem, based
on my experience, it is likely that some of your code accessing some
ASP.NET runtime intrinsic objects which are not available at design-time
when the web control is hosted in IDE's design-view.....

For runtime, the ASP.NET runtime will construct a HttpContext for each
asp.net page request, and we can access thjose intrinsic objects like
Request, Response, Session...... However, all this is not available in
design-time , at that time the control is hosted in IDE's design-time
form..... So we should not put our control's runtime specific code in some
place which will be called at design-time....

Are you putting most of the code in the Control's "Render" method? By
default, if we don't specify a custom ControlDesigner for our webcontrol,
the VS.NET will use the Control's "Render" method to generate the html
being displayed in IDE..... So I think there must have some code in the
render method which cause the error.... You can try simplify the Render
method or comment code step by step to find the break point....

If there're anything unclear or any other question, please feel free to
post here.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "Dave Slinn" <(E-Mail Removed)>
| Subject: Help with creating a control that generates dynamic image
| Date: Mon, 12 Dec 2005 21:18:14 -0600
| Lines: 22
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| X-RFC2646: Format=Flowed; Original
| Message-ID: <Obc3bP5$(E-Mail Removed)>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
| NNTP-Posting-Host: online.gms.ca 142.165.52.112
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingc ontrols:14111
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
|
| I am using various System.Drawing classes to create a graphic at runtime,
| with the resulting image varied based on some properties the user may
have
| set.
|
| Currently I have the graphic being saved to the file system (in a
subfolder
| of the web app) and then my web control renders a src attrobute to this
| graphic file (.png), which works ok at runtime, but this mechanism
doesn't
| seem to work when viewing the control at design time in Visual Studio. I
| did create this control in a Web Control Library project, and referenced
the
| assembly through my Toolbox, and can now drag and drop instances from
there,
| but the image displayed on the visual studio designer appears as a broken
| graphic (the square with the red X in it).
|
| How can I get the graphic to display properly at design time - can write
the
| graphic to the Response.OutputStream instead of saving it to the file
| system? Any web articles or source code samples pointing me in the write
| direction of creating an ASP.NET control that generates an image using
the
| GDI+ stuff would be most appreciated.
|
| - Dave Slinn
|
|
|

 
Reply With Quote
 
 
 
 
Antonio Bakula
Guest
Posts: n/a
 
      12-15-2005
On Mon, 12 Dec 2005 21:18:14 -0600, Dave Slinn wrote:

> I am using various System.Drawing classes to create a graphic at runtime,
> with the resulting image varied based on some properties the user may have
> set.
> system? Any web articles or source code samples pointing me in the write
> direction of creating an ASP.NET control that generates an image using the
> GDI+ stuff would be most appreciated.



http://www.antoniob.com/projects/PStreamImage.aspx



--
http://www.antoniob.com/
remove antispam XremoveX from e-mail !
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Re: design a tree structure which generates dynamic substrees Kai-Uwe Bux C++ 1 11-29-2008 08:54 AM
How to pass large amount of data to a script that generates a dynamic image? computer_guy ASP .Net 4 07-20-2007 11:10 PM
"Error Creating Control" when creating a custom control (Design Time). Can't see tooltip message. Ravi Ambros Wallau ASP .Net 0 06-01-2005 02:36 PM
Doubt about how a linker generates a memory image Mayank Kaushik C Programming 3 02-18-2005 02:33 PM



Advertisments