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 / samples4 / ch09 / bmrotate.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-02-16  |  2.5 KB  |  77 lines

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