真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

包含vb.net位圖能旋轉(zhuǎn)嗎的詞條

VB怎樣使圖形或控件按角度旋轉(zhuǎn)?

如果是控件,暫時(shí)沒有這個(gè)功能;如果是圖片的話,就目前來說,需要使用Point方法和PSet方法。通過坐標(biāo)變換自己手動(dòng)寫代碼,很麻煩,而且效率很低,除非你用其他語言寫一個(gè)DLL,直接通過Bitmap繪制,這樣會(huì)比較快一點(diǎn)。

成都創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供福山網(wǎng)站建設(shè)、福山做網(wǎng)站、福山網(wǎng)站設(shè)計(jì)、福山網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、福山企業(yè)網(wǎng)站模板建站服務(wù),10余年福山做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

VB 如何旋轉(zhuǎn)圖片

你的“旋轉(zhuǎn)”操作的用途是什么?

這個(gè)很重要的問題,居然只字未提……

如果是想把圖片旋轉(zhuǎn)后進(jìn)行繪制(輸出),可以用API函數(shù)PlgBlt( )來完成。

 用它可以任意角度旋轉(zhuǎn)(也支持透明的)后繪制。

如果你要把圖片文件旋轉(zhuǎn)后,形成另一個(gè)圖片文件,這個(gè)我就不清楚如何處理了。

(當(dāng)然不透明還是好辦,但要保持原來的透明部分仍然透明,我還真沒把握)

怎么用vb實(shí)現(xiàn)圖形的旋轉(zhuǎn)?

啟動(dòng)vb6建立一個(gè)標(biāo)準(zhǔn)exe工程,首先添加兩個(gè)圖片框(picture1和picture2),添加三個(gè)命令按鈕command1(caption=“正常顯示”)、command2(caption=“180度倒立”)、command3(caption=“45度旋轉(zhuǎn)”),雙擊窗體,寫入以下代碼:

PrivateConstSRCCOPY=HCC0020

PrivateConstPi=3.14

PrivateDeclareFunctionSetPixelLib"gdi32"(ByValhdcAsLong, ByValxAsLong,ByValyAsLong,ByValcrColorAsLong)AsLong

PrivateDeclareFunctionGetPixelLib"gdi32"(ByValhdcAsLong, ByValxAsLong,ByValyAsLong)AsLong

PrivateDeclareFunctionStretchBltLib"gdi32"(ByValhdcAsLong, ByValxAsLong,ByValyAsLong,ByValnWidthAsLong,ByValnHeightAsLong, ByValhSrcDCAsLong,ByValxSrcAsLong,ByValySrcAsLong,ByValnSrcWidth AsLong,ByValnSrcHeightAsLong,ByValdwRopAsLong)AsLong

privateSubbmp_rotate(pic1AsPictureBox,pic2AsPictureBox,ByValtheta)‘45度旋轉(zhuǎn)

Dimc1xAsInteger,c1yAsInteger

Dimc2xAsInteger,c2yAsInteger

DimaAsSingle

Dimp1xAsInteger,p1yAsInteger

Dimp2xAsInteger,p2yAsInteger

DimnAsInteger,rAsInteger

c1x=pic1.ScaleWidth\2

c1y=pic1.ScaleHeight\2

c2x=pic2.ScaleWidth\2

c2y=pic2.ScaleHeight\2

Ifc2x$#@60;c2yThenn=c2yElsen=c2x

n=n-1

pic1hDC=pic1.hdc

pic2hDC=pic2.hdc

Forp2x=0Ton

Forp2y=0Ton

Ifp2x=0Thena=Pi/2Elsea=Atn(p2y/p2x)

r=Sqr(1*p2x*p2x+1*p2y*p2y)

p1x=r*Cos(a+theta)

p1y=r*Sin(a+theta)

c0=GetPixel(pic1hDC,c1x+p1x,c1y+p1y)

c1=GetPixel(pic1hDC,c1x-p1x,c1y-p1y)

c2=GetPixel(pic1hDC,c1x+p1y,c1y-p1x)

c3=GetPixel(pic1hDC,c1x-p1y,c1y+p1x)

Ifc0$#@60;$#@62;-1ThenSetPixelpic2hDC,c2x+p2x,c2y+p2y,c0

Ifc1$#@60;$#@62;-1ThenSetPixelpic2hDC,c2x-p2x,c2y-p2y,c1

Ifc2$#@60;$#@62;-1ThenSetPi pic2hDC,c2x+p2y,c2y-p2x,c2

Ifc3$#@60;$#@62;-1ThenSetPixelpic2hDC,c2x-p2y,c2y+p2x,c3

Next

Next

EndSub

PrivateSubCommand1_Click()‘正常復(fù)制

Picture2.Cls

px=Picture1.ScaleWidth

py=Picture1.ScaleHeight

StretchBltPicture2.hdc,px,0,-px,py,Picture1.hdc,0,0,px,py,SRCCOPY

EndSub

PrivateSubCommand2_Click()‘180度倒立

Picture2.Cls

px=Picture1.ScaleWidth

py=Picture1.ScaleHeight

StretchBltPicture2.hdc,0,py,px,-py,Picture1.hdc,0,0,px,py,SRCCOPY

EndSub

PrivateSubCommand3_Click()‘45旋轉(zhuǎn)

Picture2.Cls

Callbmp_rotate(Picture1,Picture2,3.14/4)

EndSub

PrivateSubForm_Load()

OnErrorResumeNext

Me.Caption=App.Title"添加應(yīng)用程序標(biāo)題

Me.Left=(Screen.Width-Me.Width)/2

Me.Top=(Screen.Height-Me.Height)/2"窗體具中

Picture1.ScaleMode=3

Picture2.ScaleMode=3

EndSub

在vb中怎樣實(shí)現(xiàn)image圖像框的90,180,270度旋轉(zhuǎn),不是圖形框picturebox哦,希望用簡(jiǎn)單點(diǎn)方式

image圖像框只是如實(shí)反映圖像,要旋轉(zhuǎn)圖像才行。

先把img的圖像存到pic,旋轉(zhuǎn)后再........。

下面是旋轉(zhuǎn)pic的,原圖image=》picMMM,

處理后=》picAAA,再=》image

Public Sub bbsXuanZhuan(RorV As Integer) '旋轉(zhuǎn)or鏡像

''模塊級(jí)聲明 用于旋轉(zhuǎn)位圖

'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 pt = 15 '1 像素 = 15 pix

Dim MyPoint(2) As POINTAPI

Select Case RorV

Case 1 '90

MyPoint(0).X = 0

MyPoint(0).Y = picMMM.Width / pt

MyPoint(1).X = 0

MyPoint(1).Y = 0

MyPoint(2).X = picMMM.Height / pt

MyPoint(2).Y = picMMM.Width / pt

picAAA.Width = picMMM.Height

picAAA.Height = picMMM.Width

Case 2 '180

MyPoint(0).X = picMMM.Width / pt

MyPoint(0).Y = picMMM.Height / pt

MyPoint(1).X = 0

MyPoint(1).Y = picMMM.Height / pt

MyPoint(2).X = picMMM.Width / pt

MyPoint(2).Y = 0

picAAA.Width = picMMM.Width

picAAA.Height = picMMM.Height

Case 0 '270

MyPoint(0).X = picMMM.Height / pt

MyPoint(0).Y = 0

MyPoint(1).X = picMMM.Height / pt

MyPoint(1).Y = picMMM.Width / pt

MyPoint(2).X = 0

MyPoint(2).Y = 0

picAAA.Width = picMMM.Height

picAAA.Height = picMMM.Width

Case 4 '垂直

MyPoint(0).X = 0

MyPoint(0).Y = picMMM.Height / pt

MyPoint(1).X = picMMM.Width / pt

MyPoint(1).Y = picMMM.Height / pt

MyPoint(2).X = 0

MyPoint(2).Y = 0

picAAA.Width = picMMM.Width

picAAA.Height = picMMM.Height

Case 3 '水平

MyPoint(0).X = picMMM.Width / pt

MyPoint(0).Y = 0

MyPoint(1).X = 0

MyPoint(1).Y = 0

MyPoint(2).X = picMMM.Width / pt

MyPoint(2).Y = picMMM.Height / pt

picAAA.Width = picMMM.Width

picAAA.Height = picMMM.Height

Case Else

Exit Sub

End Select

'旋轉(zhuǎn)位圖

PlgBlt picAAA.hdc, MyPoint(0), picMMM.hdc, 0, 0, picMMM.Width / pt, picMMM.Height / pt, 0, 0, 0

End Sub

vb中,怎么可以把一張圖片旋轉(zhuǎn)起來

這個(gè)問題不是小問題。如果只是90度轉(zhuǎn),vb.net的picture控件有RotateFlip方法。

任意角度,可以參考這個(gè)

;cs-lang=csharp

圖片的變換涉及坐標(biāo)處理,要自己算。

還有可以用Windows Presentation Foundation (WPF) 編程,里面的image控件好像也能旋轉(zhuǎn)圖片。

如果是VB6,恐怕只能用API函數(shù)了,百度一下“vb 旋轉(zhuǎn)圖片” “VB api函數(shù)”了解一下


分享名稱:包含vb.net位圖能旋轉(zhuǎn)嗎的詞條
鏈接URL:http://weahome.cn/article/hepdpj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部