Avatar billede langejens Nybegynder
13. marts 2001 - 11:19 Der er 1 kommentar og
1 løsning

Vend Billede 90 %

Her er min kode:

Dim a As Picture

Private Sub Command1_Click()

Set a = LoadPicture(Text1.Text)
Printer.PaintPicture a, 8500, 500, 7250, 10500

Printer.EndDoc

End Sub

Hvordan vender jeg billede 90 % mod uret

Er det ikke noget med : a.Render ?

Avatar billede langejens Nybegynder
13. marts 2001 - 13:14 #1
Lille fejl.... jeg mener grader ikke %
Avatar billede sjh Nybegynder
13. marts 2001 - 22:37 #2
Hej langejens. prøv:


\'2 PictureBox
\'1 TextBox
\'1 CommandButton
\'------------------------------ Module1 ------------------------------
Global Const SRCCOPY = &HCC0020
Global Const Pi = 3.14159265359
Declare Function SetPixel Lib \"gdi32\" (ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long, ByVal crColor As Long) As Long

Declare Function GetPixel Lib \"gdi32\" (ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long) As Long

Declare Function StretchBlt Lib \"gdi32\" (ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, _
ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Function RotateImage(pic1 As PictureBox, pic2 As PictureBox, ByVal theta!)
Dim c1x As Integer, c1y As Integer
Dim c2x As Integer, c2y As Integer
Dim a As Single
Dim p1x As Integer, p1y As Integer
Dim p2x As Integer, p2y As Integer
Dim n As Integer, r As Integer
   
    c1x = pic1.ScaleWidth \\ 2
    c1y = pic1.ScaleHeight \\ 2
    c2x = pic2.ScaleWidth \\ 2
    c2y = pic2.ScaleHeight \\ 2
    If c2x < c2y Then n = c2y Else n = c2x
    n = n - 1
    pic1hDC% = pic1.hdc
    pic2hDC% = pic2.hdc
    For p2x = 0 To n
        For p2y = 0 To n
            If p2x = 0 Then a = Pi / 2 Else a = 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)
            If c0& <> -1 Then xret& = SetPixel(pic2hDC%, c2x + p2x, c2y + p2y, c0&)
            If c1& <> -1 Then xret& = SetPixel(pic2hDC%, c2x - p2x, c2y - p2y, c1&)
            If c2& <> -1 Then xret& = SetPixel(pic2hDC%, c2x + p2y, c2y - p2x, c2&)
            If c3& <> -1 Then xret& = SetPixel(pic2hDC%, c2x - p2y, c2y + p2x, c3&)
        Next
        t% = DoEvents()
    Next
End Function
\'------------------------------ Module1 ------------------------------


\'------------------------------ Form1 ------------------------------
Private Sub Command1_Click()
Dim Angle2Rotate
Angle2Rotate = -(Text1.Text)
Picture2.Cls
RotateImage Picture1, Picture2, Angle2Rotate / 180 * Pi
End Sub

Private Sub Form_Load()
Picture1.ScaleMode = 3
Picture2.ScaleMode = 3
Text1.Text = 90
End Sub
\'------------------------------ Form1 ------------------------------
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester