home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples5 / ch09 / bmrotate.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-02-16  |  2.5 KB  |  74 lines

  1. VERSION 5.00
  2. Begin VB.Form frmBMRotate 
  3.    Caption         =   "Bitmap Rotation"
  4.    ClientHeight    =   4500
  5.    ClientLeft      =   1110
  6.    ClientTop       =   1530
  7.    ClientWidth     =   6330
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   4500
  11.    ScaleWidth      =   6330
  12.    Begin VB.PictureBox picRotate 
  13.       Height          =   4275
  14.       Left            =   2220
  15.       ScaleHeight     =   283
  16.       ScaleMode       =   3  'Pixel
  17.       ScaleWidth      =   259
  18.       TabIndex        =   1
  19.       Top             =   120
  20.       Width           =   3915
  21.    End
  22.    Begin VB.PictureBox picSource 
  23.       AutoSize        =   -1  'True
  24.       Height          =   2430
  25.       Left            =   240
  26.       Picture         =   "BMROTATE.frx":0000
  27.       ScaleHeight     =   160
  28.       ScaleMode       =   3  'Pixel
  29.       ScaleWidth      =   123
  30.       TabIndex        =   0
  31.       Top             =   300
  32.       Width           =   1875
  33.    End
  34.    Begin VB.Label Label1 
  35.       Caption         =   $"BMROTATE.frx":2882
  36.       Height          =   1455
  37.       Left            =   240
  38.       TabIndex        =   2
  39.       Top             =   2880
  40.       Width           =   1815
  41.    End
  42. Attribute VB_Name = "frmBMRotate"
  43. Attribute VB_GlobalNameSpace = False
  44. Attribute VB_Creatable = False
  45. Attribute VB_PredeclaredId = True
  46. Attribute VB_Exposed = False
  47. Option Explicit
  48. ' Copyright 
  49.  1997 by Desaware Inc. All Rights Reserved
  50. Private Type POINTAPI
  51.         X As Long
  52.         Y As Long
  53. End Type
  54. Dim pts(2) As POINTAPI
  55. Dim currentpoint%
  56. 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
  57. Private Sub picRotate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  58.     Dim di&
  59.     pts(currentpoint).X = X
  60.     pts(currentpoint).Y = Y
  61.     Select Case currentpoint
  62.         Case 0
  63.             picRotate.Cls
  64.             picRotate.Circle (X, Y), 2, 0
  65.         Case 1
  66.             picRotate.Circle (X, Y), 2, 0
  67.         Case 2
  68.             picRotate.Cls
  69.             di = PlgBlt(picRotate.hDC, pts(0), picSource.hDC, 0, 0, picSource.ScaleWidth, picSource.ScaleHeight, 0, 0, 0)
  70.     End Select
  71.     currentpoint = currentpoint + 1
  72.     If currentpoint = 3 Then currentpoint = 0
  73. End Sub
  74.