1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
| Option Explicit
'pour rotation de l'affichage du curseur
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
Private Declare Function SetDIBits Lib "gdi32" ( _
ByVal hdc As Long, _
ByVal hBitmap As Long, _
ByVal nStartScan As Long, _
ByVal nNumScans As Long, _
lpBits As Any, _
lpBI As BITMAPINFO, _
ByVal wUsage As Long) As Long
Private Declare Function GetDIBits Lib "gdi32" ( _
ByVal aHDC As Long, _
ByVal hBitmap As Long, _
ByVal nStartScan As Long, _
ByVal nNumScans As Long, _
lpBits As Any, _
lpBI As BITMAPINFO, _
ByVal wUsage As Long) As Long
' fin pour rotation de l'affichage
Dim T As Integer, U As Integer
Dim MotsTitre(4) As String
Private Sub Form_Load()
Me.Height = 3990: Me.Width = 5115
Command1.Move 180, 60, 1755, 345: Command1.Caption = "Go"
LabFormats.Move 2070, 120: LabFormats.BorderStyle = 0: LabFormats.AutoSize = True
msftableau.Appearance = flexFlat
msftableau.Move 120, 480, 4755, 3015
PictSource.Appearance = 0: PictSource.ScaleMode = vbPixels: PictSource.AutoRedraw = True
PictSource.Move 120, 3570
PictResult.Appearance = 0: PictResult.ScaleMode = vbPixels: PictResult.AutoRedraw = True
PictResult.Move 120, 3960
LabFormats.Visible = False: PictSource.Visible = False: PictResult.Visible = False
MotsTitre(0) = "Faute/obstacles"
MotsTitre(1) = "Barre"
MotsTitre(2) = "Refus"
MotsTitre(3) = "Chute"
MotsTitre(4) = "Désobéïssance"
msftableau.Rows = 5: msftableau.Cols = 6
LabFormats.FontName = msftableau.Font
LabFormats.FontSize = msftableau.Font.Size
LabFormats.FontBold = True
'LabFormats.FontBold = False
PictSource.Height = LabFormats.Height
PictSource.FontName = msftableau.Font
PictSource.FontSize = msftableau.Font.Size
PictSource.FontBold = LabFormats.FontBold
PictSource.ForeColor = msftableau.ForeColorFixed
PictSource.BackColor = msftableau.BackColorFixed
End Sub
Private Sub Command1_Click()
Dim Maxlarge As Integer
Maxlarge = 0
For T = 0 To 4
LabFormats = MotsTitre(0)
If LabFormats.Width > Maxlarge Then Maxlarge = LabFormats.Width
Next T
msftableau.RowHeight(0) = Maxlarge + 90
msftableau.Row = 0
For T = 0 To 5
msftableau.ColWidth(T) = LabFormats.Height + 390
Next T
For T = 1 To 5
LabFormats = MotsTitre(T - 1)
PictSource.Width = LabFormats.Width + 90
PictSource.Cls: PictSource.CurrentX = 2: PictSource.Print MotsTitre(T - 1)
PivoteR "D" 'ou G au choix
msftableau.Col = T
msftableau.CellPictureAlignment = flexAlignCenterBottom ' ou flexAlignCenterTop ou ....
Set msftableau.CellPicture = PictResult.Image 'place l'image
Next T
End Sub
Private Sub PivoteR(SenS As String)
Dim Buffer() As RGBQUAD, Result() As RGBQUAD
Dim MeWidth As Long, MeHeight As Long
Dim BMPINFO As BITMAPINFO
Dim BMPINFOH As BITMAPINFOHEADER
Dim X As Long, Y As Long, XX As Long, YY As Long
MeWidth = PictSource.ScaleWidth: MeHeight = PictSource.ScaleHeight
ReDim Buffer(0 To MeWidth - 1, 0 To MeHeight - 1)
With BMPINFOH
.biBitCount = 32
.biHeight = MeHeight: .biWidth = MeWidth
.biPlanes = 1: .biSize = Len(BMPINFOH)
End With
BMPINFO.bmiHeader = BMPINFOH
GetDIBits PictSource.hdc, PictSource.Image.Handle, 0, MeHeight, Buffer(0, 0), BMPINFO, 0
X = UBound(Buffer, 1): Y = UBound(Buffer, 2)
ReDim Result(0 To Y, 0 To X)
If SenS = "G" Then 'rotation 90° a gauche
For XX = 0 To X
For YY = 0 To Y: Result(Y - YY, XX) = Buffer(XX, YY): Next YY
Next XX
Else 'rotation 90° a droite
For XX = 0 To X
For YY = 0 To Y: Result(YY, X - XX) = Buffer(XX, YY): Next YY
Next XX
End If
PictResult.Width = PictSource.Height: PictResult.Height = PictSource.Width
With BMPINFOH
.biBitCount = 32
.biHeight = MeWidth: .biWidth = MeHeight
.biPlanes = 1: .biSize = Len(BMPINFOH)
End With
BMPINFO.bmiHeader = BMPINFOH
PictResult.Cls
SetDIBits PictResult.hdc, PictResult.Image.Handle, 0, MeWidth, Result(0, 0), BMPINFO, 0
End Sub |
Partager