显示新的位图 [英] display new bitmap

查看:64
本文介绍了显示新的位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mainpage.aspx上点击了一个按钮。我想显示一个新的

网页,它只有我的图像,这是一个jpg。我希望页面是一个

..jpg而不是aspx,以便用户可以轻松保存到磁盘。


我怎么能这样做吗?

谢谢,

T

I''m in a button clicked event on mainpage.aspx. I want to display a new
webpage that has just my image, which is a jpg. I want the page to be a
..jpg not an aspx so that it will be easy for the user to save to disk.

How can I do this?
Thanks,
T

推荐答案




更改ContentType并写入jpeg。

Response.ContentType =" image / jepg"

...

oBmp =新位图(strPath)

...

oBmp.Save(Response.OutputStream,

System.Drawing.Imaging。 ImageFormat.Jpeg)


Natty Gur,首席技术官

Dao2Com Ltd.

34th Elkalay st。 Raanana

以色列,43000

电话号码:

办公室:+ 972-(0)9-7740261

传真:+ 972-(0)9-7740261

手机:+ 972-(0)58-888377

***通过Developersdex发送 http://www.developersdex.com ***

不要只是参与在USENET ...获得奖励!
Hi,

change the ContentType and write the jpeg.
Response.ContentType = "image/jepg"
...
oBmp = New Bitmap(strPath)
...
oBmp.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg)

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


涉及两个页面,webform1.aspx和HiRes.aspx。在

Webform1.aspx我写了一个.jpg到d的根:并执行:

Server.Transfer(" HiRes.aspx")


HiRes.aspx如下:

<%@ Page Language =" vb"的ContentType = QUOT;图像/ JPEG" AutoEventWireup =" false"
Codebehind =" HiRes.aspx.vb" Inherits =" DBAPhotoQuery.HiRes"%>

<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.0 Transitional // EN">

< html>

< head>

< title> test< / title>

< meta name =" GENERATOR" ; content =" Microsoft Visual Studio .NET 7.1"

< meta name =" CODE_LANGUAGE" content =" Visual Basic .NET 7.1"

< meta name = vs_defaultClientScript content =" JavaScript">

< meta name = vs_targetSchema < br $>
content =" http://schemas.microsoft.com/intellisense/ie5">

< / head>

< body MS_POSITIONING =" GridLayout">


< form id =" Form1"目标= QUOT; _blank"方法= QUOT;交" runat =" server">


< / form>


< / body>

< / html>


和hires.aspx的CodeBehind如下:


Imports System.Drawing.Imaging

Public Class HiRes

Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理MyBase.Load

Response.Clear()

Dim oBmp As Bitmap

oBmp =新位图(" d:\ bigpic.jpg")

oBmp.Save(Response.OutputStream,imageformat.jpeg)

Response.End()

结束次级

结束班级


会发生什么事情,图片确实写完了但是

webform1的.aspx。 webform1.aspx中的内容完全被

图像取代。你可能会注意到我把Target =" _blank"试图获得它

来显示一个新的ie页面。

谢谢,

T

"杰里三世 < JE ****** @ hotmail.com>在消息中写道

新闻:uL ************** @ TK2MSFTNGP10.phx.gbl ...
there are two pages involved, webform1.aspx and HiRes.aspx. In
Webform1.aspx I write a .jpg to the root of d: and do :
Server.Transfer("HiRes.aspx")

HiRes.aspx is as follows:
<%@ Page Language="vb" ContentType="image/jpeg" AutoEventWireup="false"
Codebehind="HiRes.aspx.vb" Inherits="DBAPhotoQuery.HiRes"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" target="_blank" method="post" runat="server">

</form>

</body>
</html>

and the CodeBehind for hires.aspx is as follows:

Imports System.Drawing.Imaging
Public Class HiRes
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Response.Clear()
Dim oBmp As Bitmap
oBmp = New Bitmap("d:\bigpic.jpg")
oBmp.Save(Response.OutputStream, imageformat.jpeg)
Response.End()
End Sub
End Class

What happens is that the picture does indeed get written but to
webform1.aspx. What was in webform1.aspx is completely replaced by just the
image. You might notice that I put Target="_blank" in an attempt to get it
to display a new i.e. page.
Thanks,
T
"Jerry III" <je******@hotmail.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...
它是什么来的?你清楚地告诉客户它是一个
图像/ jpeg并且你正在保存它并且我一直这样做
并且它工作得很好。你可以再详细一点吗?也许你比对照片保存更多
或者你没有正确设置标题......

杰里

蒂娜 ; < TI ********** @ excite.com>在消息中写道
新闻:uz ************** @ TK2MSFTNGP10.phx.gbl ...
What does it come as? You''re clearly telling the client that it''s an
image/jpeg and you''re saving it as such and I''m doing this all the time and it works just fine. Could you be more specific? Maybe you''re saving more
than the image to the response or you''re not setting the headers right...

Jerry

"Tina" <ti**********@excite.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
Natty,
那不是'以.jpg格式进入客户端浏览器并且
Natty,
That doesn''t come through to the client browser as a .jpg and is there


要么不可能,要么很难将文件保存为.jpg。
either impossible or very difficult for them to save the file as a .jpg.


从静态页面一直这样做,但似乎无法通过aspx页面和vb.net代码使它工作

谢谢,
Natty Gur < NA *** @ dao2com.com>在消息中写道
新闻:e1 ************* @ TK2MSFTNGP11.phx.gbl ...
do this all the time from static pages but can''t seem to make it work from aspx pages and vb.net code.
Thanks,
T
"Natty Gur" <na***@dao2com.com> wrote in message
news:e1*************@TK2MSFTNGP11.phx.gbl...


更改ContentType并编写jpeg。
Response.ContentType =" image / jepg"
..
oBmp =新位图(strPath)
..
oBmp .Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg)

Natty Gur,首席技术官
Dao2Com Ltd.
第34届Elkalay st。 Raanana
以色列,43000
电话号码:
办公室:+ 972-(0)9-7740261
传真:+ 972-(0)9-7740261
手机:+ 972-(0)58-888377

***通过开发人员指南发送http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
Hi,

change the ContentType and write the jpeg.
Response.ContentType = "image/jepg"
..
oBmp = New Bitmap(strPath)
..
oBmp.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg)

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!





你没有设置内容标题:

Response.ContentType =" image / jepg"

Natty Gur,首席技术官

Dao2Com Ltd.

34th Elkalay st。 Raanana

以色列,43000

电话号码:

办公室:+ 972-(0)9-7740261

传真:+ 972-(0)9-7740261

手机:+ 972-(0)58-888377

***通过Developersdex发送 http://www.developersdex.com ***

不要只是参与在USENET ......获得奖励!
You dont set the content header :

Response.ContentType = "image/jepg"
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于显示新的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆