Option Explicit
Private m_Deformation As IDeformation2
Private Function SlightlyComplicatedCalculation(ByVal Param1 As Long, ByVal Param2 As Single) As Double
Return (Param1+(Param2/3.141-(Param1/6 + (2*param1+fn(x, (x+1)))) + 42)) + 11
End Function
Private Property Get QueryString() As String
Dim sql As String
Dim SomeCondition As String
SomeCondition = "FirstName='Smith'"
sql = "SELECT SomeField FROM SomeTable WHERE " & SomeCondition
QueryString = sql
End Property
Public Function MakeUpSomeJs As String
Dim js As String
js = "var r = function() { var x = DoSomeJQueryStuff(); return x+1 }"
Return js
End Function
Public Function MakeUpSomeJsThatWritesSql As String
Dim js As String
js = "var r = function() { return 'SELECT * FROM ' + name_of_table + ' WHERE ' + condition }";
Return js;
End Function
Private Sub Form_Activate()
Static AlreadyActivated As Boolean
If AlreadyActivated Then
Exit Sub
End If
AlreadyActivated = True
Dim OriginalPicture As IPicture
Dim OriginalFilename As String
Dim OriginalDimensions As Rect
OriginalFilename = "OriginalImage.bmp"
Set OriginalPicture = LoadPicture(OriginalFilename)
OriginalDimensions = GetPictureDimensions(OriginalPicture)
Dim hdcOffscreen As Long
Dim hTemp As Long
hdcOffscreen = CreateCompatibleDC(Me.hdc)
hTemp = SelectObject(hdcOffscreen, OriginalPicture.Handle)
InitializeDeformation OriginalDimensions
PaintOriginalImage hdcOffscreen, OriginalDimensions
PaintModifiedImage hdcOffscreen, OriginalDimensions
SelectObject hdcOffscreen, hTemp
DeleteDC hdcOffscreen
End Sub
Private Sub InitializeDeformation(ByRef OriginalDimensions As Rect)
Dim t As Transform2
Set t = New Transform2
t.Rotate Pi / 4
Set m_Deformation = t
Dim NewDimensions As Rect
NewDimensions = OriginalDimensions
m_Deformation.ApplyToDimensions NewDimensions
t.Translate -NewDimensions.Left, -NewDimensions.Top
End Sub
Private Sub PaintOriginalImage(ByVal hdcOffscreen As Long, ByRef OriginalDimensions As Rect)
Dim x As Long
Dim y As Long
For y = 0 To OriginalDimensions.Bottom - 1
For x = 0 To OriginalDimensions.Right - 1
SetPixel hdc, x, y, GetPixel(hdcOffscreen, x, y)
Next x
Next y
End Sub
Private Sub PaintModifiedImage(ByVal hdcOffscreen As Long, ByRef OriginalDimensions As Rect)
Dim NewDimensions As Rect
Dim OriginalCoordinates As Coordinates2
Dim DummyColor As RgbQuad
NewDimensions = OriginalDimensions
m_Deformation.ApplyToDimensions NewDimensions
Dim x As Long
Dim y As Long
For y = 0 To NewDimensions.Bottom + 1
For x = 0 To NewDimensions.Right + 1
OriginalCoordinates = MakeCoordinates2(x, y)
If m_Deformation.UnApply(OriginalCoordinates, DummyColor, OriginalDimensions) Then
If RectBoundsPoint(OriginalCoordinates, OriginalDimensions) Then
SetPixel hdc, OriginalDimensions.Right + x, y, GetPixel(hdcOffscreen, OriginalCoordinates.x, OriginalCoordinates.y)
End If
End If
Next x
Next y
End Sub