Re: Drawing a rectangle on a web page

From: Ryan (anonymous_at_discussions.microsoft.com)
Date: 02/23/05


Date: Wed, 23 Feb 2005 09:52:08 -0800

Hello Derek,

Thank you very much for giving me a detailed information
on creating graphics on a web form.

let me explain the issue in a detailed way.
I'm creating a web page which will display the MAP as a
JPG file. I want to create an ZOOM IN event - when the
user clicks on 'zoom in' button, he should be able to
draw a rectangle on the map. The program should also
capture the starting and ending points of the rectangle,
so that I can pass the co-ordinates to the server which
will get me the new image.

I think the best option is to throw out the windows code
all together and build a new one.

Any help would be really appreciated.

Regards
Ryan

>-----Original Message-----
>"Ryan" <anonymous@discussions.microsoft.com> wrote in
message news:090a01c51944$90f08700$a601280a@phx.gbl...
>> I'm trying to draw a rectangle on a web page which
>> contains a picture. Following is the function for a
>> similar windows application.
>: :
>> When I'm building the solution its giving me an error
>> System.Web.UI.Webcontrols.Image doesn't contain a
>> definition for handle.
>
>There are a number of fundamental differences between
Windows
>(rich client) graphics and Web (thin client) graphics.
You pretty
>much have to either (a) throw out that Windows code
altogether,
>or (b) salvage it perhaps by using WinForms graphics
code to
>render drawings to a Bitmap and then save off that
Bitmap (as
>a .jpg, .gif, or other graphics file format) to some
location on the
>web server that clients can reach (be careful if you do
save a
>file from your Web application that the ASPNET account
has
>security privileges granted to it sufficient enough to
create the
>image file on the server's file system).
>
>If there's a dynamically generated image file on the
server for the
>Web Form to refer to using an IMG tag, then it's simply
a matter
>of rendering <IMG SRC="url_of_your_graphics_file.png" />
out to
>the HTTP response stream when the page renders. This
still carries
>the problem of how to clean-up after such dynamically
generated
>files, though (because of ASP.NET's inherent
statelessness).
>
>Nothing in that Windows function will give you a clue
about the Web
>environment. In an ASP.NET WebForms application, you
much
>render HTML markup to the client's web browser -- this
is all text
>that describes what the page should look like. Browsers
like Internet
>Explorer, Mozilla, and Firefox all interpret the HTML
and display it
>to your end user (sometimes these browsers will
interpret the HTML
>in varied and unexpected ways! Web progamming isn't
just a job,
>it's a neverending epic adventure ...) Usually they
create peer con-
>trols using the end user's own operating system's rich
graphics sub-
>system, that correspond to HTML elements that a user can
interact
>with. However, the exact characteristics of a button to
a user on
>Internet Explorer / Windows XP with an Olive color
scheme will
>differ from the appearance of a button to a user on
Firefox /
>Macintosh. As a web developer, you usually don't have
control
>over what peer exactly the browser chooses to represent
your
>HTML elements as.
>
>To draw a box in HTML, you would render this markup,
>
><table border="1"><tr><td> </td></tr></table>
>
>What you could do in Visual Studio .NET is create a Web
>Custom Control library (using that project type),
override
>the Render method in the class file it produces for you
to
>write that string above to the HtmlTextWriter argument it
>receives, then build this library. Next, open the
Toolbox
>with Control-Alt-X key, and Customize one of the tabs,
>so that you can Add a .NET Framework component.
>Browse until you find the .dll file that you just
created,
>the Custom Control library, and drag and drop that
>onto your WebForm1.aspx's Design View. You should
>see a preview of the box at design-time, similar to what
>it would look like at run-time.
>
>Other subjects you may want to investigate for more
>information are VML (Vector Markup Language) and
>it's successor, SVG (Scalable Vector Graphics). VML
>is obsolete but it has the benefit of being built-in to
Internet
>Explorer 5 (but no other brands of browser). SVG is the
>heir to the throne, but it still requires that you
install a plug
>in to make your browser display SVG (Adobe offers one
>free plug-in for SVG on Internet Explorer, there are also
>other plug-ins out there for SVG on Mozilla and Firefox
>brands of browser.) Until you have a tighter grasp of
the
>differences between ASP.NET and WinForms, rushing
>headlong into these specialty markup languages may be
>premature though.
>
>
>Derek Harmon
>
>
>.
>


Loading