vb中,怎么可以把一张图片旋转起来
这个问题不是小问题。如果只是90度转,vb.net的picture控件有RotateFlip方法。
创新互联建站从2013年成立,是专业互联网技术服务公司,拥有项目网站设计制作、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元庆城做网站,已为上家服务,为庆城各地企业和个人服务,联系电话:18980820575
任意角度,可以参考这个
;cs-lang=csharp
图片的变换涉及坐标处理,要自己算。
还有可以用Windows Presentation Foundation (WPF) 编程,里面的image控件好像也能旋转图片。
如果是VB6,恐怕只能用API函数了,百度一下“vb 旋转图片” “VB api函数”了解一下
VB.net 如何将数据转换为位图(Bitmap)所需要的byte()数组?急!!!!
public Byte[] getphoto(string photopath) //参数图片地址,主要用到的类有FileStream
{
string str = photopath;
FileStream file = new FileStream(str, FileMode.Open, FileAccess.Read);
Byte[] bytBLOBData = new Byte[file.Length];
file.Read(bytBLOBData, 0, bytBLOBData.Length);
file.Close();
return bytBLOBData;
}//这是定义函数..
VB.net 旋转图像时,如何指定填充色
绘制线条采用Draw开头的方法,颜色参数用Pen类;
绘制有填充色的封闭图形采用Fill开头的方法,颜色参数用Brush类;
例如:
'绘制一个实心圆,该圆在:直线x=200,y=200,x=200+100,y=200+100所划矩形区域内
Me.CreateGraphics.FillEllipse(New SolidBrush(Color.Orange), 200, 200, 100, 100)
'绘制一个空心圆,该圆在:直线x=200,y=200,x=200+100,y=200+100所划矩形区域内
Me.CreateGraphics.DrawEllipse(New Pen(Color.Black), 200, 200, 100, 100)
vb里面怎么样让一张图片旋转?
'GetPixel和SetPixel太慢了.系统有现成的API用. '本例子需要两个PictureBox,名称分别为PicBack和PicShow.一个CommandButton,名称:Command1. '在PicShow里载入一张图片,然后运行,点command1按钮,你就可以看到效果. Option Explicit Private Declare Function PlgBlt Lib "gdi32" (ByVal hdcDest As Long, lpPoint As POINTAPI, ByVal hdcSrc As Long, ByVal nXSrc As Long, ByVal nYSrc As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hbmMask As Long, ByVal xMask As Long, ByVal yMask As Long) As Long Private Type POINTAPI x As Long y As Long End Type Const NotPI = 3.14159265238 / 180 Private Sub DanRotate(ByRef picDestHdc As Long, xPos As Long, yPos As Long, ByVal Angle As Long, ByRef picSrcHdc As Long, srcXoffset As Long, srcYoffset As Long, ByVal srcWidth As Long, ByVal srcHeight As Long) Dim Points(3) As POINTAPI Dim DefPoints(3) As POINTAPI Dim sSin As Single, sCos As Single Dim ret As Long Points(0).x = -srcWidth * 0.5 Points(0).y = -srcHeight * 0.5 Points(1).x = Points(0).x + srcWidth Points(1).y = Points(0).y Points(2).x = Points(0).x Points(2).y = Points(0).y + srcHeight sSin = Sin(Angle * NotPI) sCos = Cos(Angle * NotPI) DefPoints(0).x = (Points(0).x * sCos - Points(0).y * sSin) + xPos DefPoints(0).y = (Points(0).x * sSin + Points(0).y * sCos) + yPos DefPoints(1).x = (Points(1).x * sCos - Points(1).y * sSin) + xPos DefPoints(1).y = (Points(1).x * sSin + Points(1).y * sCos) + yPos DefPoints(2).x = (Points(2).x * sCos - Points(2).y * sSin) + xPos DefPoints(2).y = (Points(2).x * sSin + Points(2).y * sCos) + yPos PlgBlt picDestHdc, DefPoints(0), picSrcHdc, srcXoffset, srcYoffset, srcWidth, srcHeight, 0, 0, 0 End Sub Private Sub Form_Load() picShow.ScaleMode = vbPixels picBack.ScaleMode = vbPixels End Sub Private Sub Command1_Click() DanRotate picBack.hDC, 100, 100, 45, picShow.hDC, 0, 0, picShow.ScaleWidth,picShow.ScaleHeight '(函数解释)DanRotate 目标(输出)的设备场景,X坐标,Y坐标,旋转角度,源设备场景,源设备场景X坐标,源设备场景Y坐标 picBack.Refresh '刷新窗体 End Sub
网站题目:.vb.net旋转位图 vbnet override
本文URL:http://scyingshan.cn/article/doicjog.html