|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
完全不一样的。.net其实我也说不太清,.net可以把他理解为跟J2EE相对的工具。c++主要做系统相关的开发你要学.net的话就应该学C#。(其实微软在.NET平台上也考虑了给C++留一个地位。紧缩
***********************************************************
立即预览保留图片质量
wgscd(c)2005QQ153964481,Email:wgscd@126.com
DimPulicImageCodecInfoAsImageCodecInfo界说全局变量进步效力
DimmyImageCodecInfoAsSystem.Drawing.Imaging.ImageCodecInfo
DimmyEncoderAsSystem.Drawing.Imaging.Encoder=System.Drawing.Imaging.Encoder.Quality
DimmyEncoderParameterAsSystem.Drawing.Imaging.EncoderParameter
DimmyEncoderParametersAsSystem.Drawing.Imaging.EncoderParameters
PrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
Me.Text="保留文件"
Me.Label2.Text="立即预览保留图片质量wgscd(c)02005使用ImageCodecInfo,System.Drawing.Imaging.Encoder"
Me.HScrollBar1.Cursor=Cursors.Hand
PulicImageCodecInfo=GetEncoderInfo("image/jpeg")猎取ImageCodecInfo
Me.PictureBox2.Image.Save("c:wgscd.jpg")
Me.PictureBox3.Image=Image.FromFile("c:wgscd.jpg")
DimfiAsNewFileInfo("c:wgscd.jpg")
fi=NewFileInfo("c:wgscd.jpg")
Label1.Text=HScrollBar1.Value&"巨细:"&(fi.Length/1024).ToString("0.00")&"KB"
Me.PictureBox3.Refresh()必需开释
Me.PictureBox3.Image.Dispose()
Me.PictureBox3.Image=Me.PictureBox2.Image
EndSub
PrivateSubHScrollBar1_Scroll(ByValsenderAsSystem.Object,ByValeAsSystem.Windows.Forms.ScrollEventArgs)HandlesHScrollBar1.Scroll
DimMyMemoryStreamAsIO.MemoryStream=NewIO.MemoryStream
myImageCodecInfo=PulicImageCodecInfo用全局保留的ImageCodecInfo来设置
myEncoderParameters=NewSystem.Drawing.Imaging.EncoderParameters(1)
myEncoderParameter=NewSystem.Drawing.Imaging.EncoderParameter(myEncoder,EncoderValue.TransformRotate90)
myEncoderParameter=NewSystem.Drawing.Imaging.EncoderParameter(myEncoder,CLng(Me.HScrollBar1.Value))
myEncoderParameters.Param(0)=myEncoderParameter
Me.PictureBox2.Save(MyMemoryStream,myImageCodecInfo,myEncoderParameters)‘写如内存流
Try
Me.PictureBox2.Image.Save("c:wgscd.jpg",myImageCodecInfo,myEncoderParameters)
Me.PictureBox3.Image=Image.FromFile("c:wgscd.jpg")
DimfiAsNewFileInfo("c:wgscd.jpg")
fi=NewFileInfo("c:wgscd.jpg")
Label1.Text="保留质量:"&HScrollBar1.Value&"%巨细:"&(fi.Length/1024).ToString("0.00")&"KB"
Me.PictureBox3.Refresh()必需开释
Me.PictureBox3.Image.Dispose()
myEncoderParameters.Dispose()
MyMemoryStream.Flush()
CatchexAsException
假如有需要处置毛病,可加代码
MsgBox(ex.ToString)
EndTry
EndSub
PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.Click
Me.Close()
EndSub
能够取得体系的ImageEncoders
SubGetImageEncoders()
DimiAsInteger
DimencodersAsSystem.Drawing.Imaging.ImageCodecInfo()=Imaging.ImageCodecInfo.GetImageEncoders
Fori=0To(encoders.Length-1)
MsgBox(encoders(i).MimeType)
Nexti
EndSub
PrivateFunctionGetEncoderInfo(ByValMYmimeTypeAsString)AsImageCodecInfo
DimiAsInteger
DimencodersAsSystem.Drawing.Imaging.ImageCodecInfo()=Imaging.ImageCodecInfo.GetImageEncoders()
Fori=0To(encoders.Length-1)
If(encoders(i).MimeType=MYmimeType)Then
MsgBox(encoders(i).MimeType)
Returnencoders(i)
EndIf
Nexti
EndFunction
因为各系统的API不同,代码调用API编写程序就会遇到很多不兼容的地方,比如Java改写后的Serv-U就不能在手机上执行,手机的游戏也不能直接在微机上执行。 |
|