问题:自动将表单另存为jpeg或gif [英] Question: Saving form as jpeg or gif automatically
本文介绍了问题:自动将表单另存为jpeg或gif的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
简单地说,如何将当前表格保存为jpeg或gif?
详细信息:我有一个带速度表控制的表格。它不断地通过db中具有不同当前速度的表循环。我想
来设置将车速表保存到当前速度,然后将表格保存为
图片,然后转到下一个等等......最终结果将是gif或
具有快照的jpeg规格。 (这最终会在图像控件中显示在
a aspx webform上。)
有什么想法吗?
谢谢!
Briefly, how do you save the current form to a jpeg or gif?
Details: I have a form with a speedometer control on it. It continually
loops through a table in a db that has different current "speeds". I want
to "set" the speedometer to the current speed, then save the form as a
picture, then go to the next one, etc... The end result would be a gif or
jpeg that has a "snapshot" of the gauge. (This would eventually show up on
a aspx webform in an image control.)
Any ideas?
Thanks!
推荐答案
此链接来自之前的帖子
< http:// groups.google.de/groups?q=gro...=de&lr=&ie=UTF
-8& selm = cuwHx16CCHA.1908%40cpmsftngxa07& rnum = 1> ;
" VB Programmer" < GR ********* @ go-intech.com>在消息中写道
新闻:O9 ************** @ tk2msftngp13.phx.gbl ...
This link is from an earlier post
<http://groups.google.de/groups?q=gro...=de&lr=&ie=UTF
-8&selm=cuwHx16CCHA.1908%40cpmsftngxa07&rnum=1>
"VB Programmer" <gr*********@go-intech.com> wrote in message
news:O9**************@tk2msftngp13.phx.gbl...
简而言之,你是怎么做的将当前表格保存为jpeg或gif?
详细信息:我有一个带有车速表控件的表格。它不断地循环通过具有不同当前速度的db中的表。我想
来设置将速度表保存到当前速度,然后将表格保存为图片,然后转到下一个等等......最终结果将是具有快照的gif或
jpeg。规格。 (这最终会在图像控件中的aspx webform上显示
。)
任何想法?
谢谢!
Briefly, how do you save the current form to a jpeg or gif?
Details: I have a form with a speedometer control on it. It continually
loops through a table in a db that has different current "speeds". I want
to "set" the speedometer to the current speed, then save the form as a
picture, then go to the next one, etc... The end result would be a gif or
jpeg that has a "snapshot" of the gauge. (This would eventually show up on a aspx webform in an image control.)
Any ideas?
Thanks!
您好VBP
下面的代码将捕获给定Control的图像并返回
BitMap。
你可以使用bmp.Save(sFilePath,Imaging.ImageFormat.Whatever)
归功于Armin这个 - 我想我是从他的一个帖子中得到的
其他地方。
问候,
Fergus
>
< code>
公共声明功能BitBlt Lib" gdi32" (_
ByVal hDestDC As IntPtr,_
ByVal x As Integer,_
ByVal y As Integer,_
ByVal nWidth As Integer,_
ByVal nHeight As Integer,_
ByVal hSrcDC As IntPtr,_
ByVal xSrc As Integer,_
ByVal ySrc作为整数,_
ByVal dwRop作为整数_
)作为整数
'' ================================================ = ==================
公共函数CaptureControl(ByVal c As Control)作为位图
Dim bmp As Bitmap
Dim gDest,gSource As Graphics
Dim hdcSource,hdcDest As IntPtr
gSource = c.CreateGraphics
尝试
gDest = Graphics.FromImage(bmp)
尝试
hdcSource = gSource.GetHdc
尝试
hdcDest = gDest.GetHdc
尝试
BitBlt(_
hdcDest,0,0,_
c。宽度,c。高度,_
hdcSource,0,0,SRCCOPY _
)
最后
gDest .ReleaseHdc(hdcDest)
结束尝试
最后
gSource.ReleaseHdc(hdcSource)
结束尝试
最后
gDest.Dispose()
结束尝试
最后
gSource.Dispose ()
结束尝试
返回bmp
结束功能
< / code>
Hi VBP
The code below will capture the given Control''s imagery and return a
BitMap.
You can the use bmp.Save (sFilePath, Imaging.ImageFormat.Whatever)
Credit to Armin for this one - I think I got it from one of his posts
elsewhere.
Regards,
Fergus
<code>
Public Declare Function BitBlt Lib "gdi32" ( _
ByVal hDestDC As IntPtr, _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hSrcDC As IntPtr, _
ByVal xSrc As Integer, _
ByVal ySrc As Integer, _
ByVal dwRop As Integer _
) As Integer
''================================================= ==================
Public Function CaptureControl(ByVal c As Control) As Bitmap
Dim bmp As Bitmap
Dim gDest, gSource As Graphics
Dim hdcSource, hdcDest As IntPtr
bmp = New Bitmap(c.Width, c.Height)
gSource = c.CreateGraphics
Try
gDest = Graphics.FromImage(bmp)
Try
hdcSource = gSource.GetHdc
Try
hdcDest = gDest.GetHdc
Try
BitBlt( _
hdcDest, 0, 0, _
c.Width, c.Height, _
hdcSource, 0, 0, SRCCOPY _
)
Finally
gDest.ReleaseHdc(hdcDest)
End Try
Finally
gSource.ReleaseHdc(hdcSource)
End Try
Finally
gDest.Dispose()
End Try
Finally
gSource.Dispose()
End Try
Return bmp
End Function
</code>
太棒了!谢谢!
" Fergus Cooney" <音响****** @ tesco.net>在消息中写道
新闻:大江************** @ tk2msftngp13.phx.gbl ...
AWESOME! Thanks!
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
你好VBP
下面的代码将捕获给定Control的图像并返回一个
BitMap。
你可以使用bmp.Save(sFilePath,Imaging.ImageFormat.Whatever)
感谢Armin这个 - 我想我是从其他地方的其他地方得到的。
问候,
Fergus
< code>
Public Declare Function BitBlt Lib" gdi32" (_
ByVal hDestDC As IntPtr,_
ByVal x As Integer,_
ByVal y As Integer,_
ByVal nWidth As Integer,_
ByVal nHeight As Integer ,_
ByVal hSrcDC As IntPtr,_
ByVal xSrc As Integer,_
ByVal ySrc As Integer,_
ByVal dwRop As Integer _
)As Integer
''========================================== ======= ==================
公共函数CaptureControl(ByVal c As Control)作为位图
Dim bmp作为位图
Dim gDest,gSource As Graphics
Dim hdcSource,hdcDest As IntPtr
bmp =新位图(c.Width,c .Height)
> gSource = c.CreateGraphics
尝试
gDest = Graphics.FromImage(bmp)
尝试
hdcSource = gSource.GetHdc
试试
hdcDest = gDest.GetHdc
尝试
BitBlt(_
hdcDest,0,0,_
c.Width,c。高度,_
hdcSource,0,0,SRCCOPY _
最后
gDest.ReleaseHdc(hdcDest)
结束尝试
最后
gSource.ReleaseHdc(hdcSource)<结束尝试
最后
gDest.Dispose()
结束尝试
最后
gSource.Dispose()
结束尝试
返回bmp
结束功能
< / code>
Hi VBP
The code below will capture the given Control''s imagery and return a
BitMap.
You can the use bmp.Save (sFilePath, Imaging.ImageFormat.Whatever)
Credit to Armin for this one - I think I got it from one of his posts
elsewhere.
Regards,
Fergus
<code>
Public Declare Function BitBlt Lib "gdi32" ( _
ByVal hDestDC As IntPtr, _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hSrcDC As IntPtr, _
ByVal xSrc As Integer, _
ByVal ySrc As Integer, _
ByVal dwRop As Integer _
) As Integer
''================================================= ==================
Public Function CaptureControl(ByVal c As Control) As Bitmap
Dim bmp As Bitmap
Dim gDest, gSource As Graphics
Dim hdcSource, hdcDest As IntPtr
bmp = New Bitmap(c.Width, c.Height)
gSource = c.CreateGraphics
Try
gDest = Graphics.FromImage(bmp)
Try
hdcSource = gSource.GetHdc
Try
hdcDest = gDest.GetHdc
Try
BitBlt( _
hdcDest, 0, 0, _
c.Width, c.Height, _
hdcSource, 0, 0, SRCCOPY _
)
Finally
gDest.ReleaseHdc(hdcDest)
End Try
Finally
gSource.ReleaseHdc(hdcSource)
End Try
Finally
gDest.Dispose()
End Try
Finally
gSource.Dispose()
End Try
Return bmp
End Function
</code>
这篇关于问题:自动将表单另存为jpeg或gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文