Procedure Name | Type | Description |
(Declarations) | Declarations | Declarations and private variables for the modFractal module. |
Julia | Procedure | Draw a Julia fractal. |
MandelBrot | Procedure | Draws a Mandelbrot fractal. |
' Example of modFractal ' ' To try this example, do the following: ' 1. Create a new form ' 2. Add a command button 'cmdDraw' ' 3. Add a slider named 'sldCX' ' 4. Add a slider named 'sldCY' ' 5. Add a slider named 'sldStartX' ' 6. Add a slider named 'sldStartY' ' 7. Add a slider named 'sldEndX' ' 8. Add a slider named 'sldEndY' ' 9. A control array of option buttons called 'optType'. ' There should be two option buttons in this group ' 10. Add an picture box called 'picFractal' ' Set the following properties ' ScaleMode Pixel ' 11. Paste all the code from this example to the new form's module ' 12. Run the form Private Const mcintJulia As Integer = 0 Private Const mcintMandelBrot As Integer = 1 Private Sub cmdDraw_Click() If optType(mcintJulia).Value = True Then 'Julia Julia picFractal.hDC, sldCX / 1000, sldCY / 1000, sldStartX / 1000, sldStartY / 1000, sldEndX / 1000, sldEndY / 1000, picFractal.ScaleWidth, picFractal.ScaleHeight, 20 Else 'Mandelbrot MandelBrot picFractal.hDC, sldStartX / 1000, sldStartY / 1000, sldEndX / 1000, sldEndY / 1000, picFractal.ScaleWidth, picFractal.ScaleHeight, 50 End If End Sub Private Sub Form_Load() sldCX.Min = -2 * 1000 sldCX.Max = 2 * 1000 sldCY.Min = -2 * 1000 sldCY.Max = 2 * 1000 sldStartX.Min = -1.5 * 1000 sldStartX.Max = 1.5 * 1000 sldStartY.Min = -1.5 * 1000 sldStartY.Max = 1.5 * 1000 sldEndX.Min = -1.5 * 1000 sldEndX.Max = 1.5 * 1000 sldEndY.Min = -1.5 * 1000 sldEndY.Max = 1.5 * 1000 optType(mcintJulia).Caption = "Julia" optType(mcintJulia).Value = True optType(mcintMandelBrot).Caption = "MandelBrot" cmdDraw.Caption = "Draw" picFractal.ScaleMode = vbPixels End Sub Private Sub Option1_Click(Index As Integer) Select Case Index Case mcintJulia ' Set the range of values defined for the Julia set sldCX.Enabled = True sldCY.Enabled = True sldCX.Min = -2 * 1000 sldCX.Max = 2 * 1000 sldCY.Min = -2 * 1000 sldCY.Max = 2 * 1000 sldStartX.Min = -1.5 * 1000 sldStartX.Max = 1.5 * 1000 sldStartY.Min = -1.5 * 1000 sldStartY.Max = 1.5 * 1000 sldEndX.Min = -1.5 * 1000 sldEndX.Max = 1.5 * 1000 sldEndY.Min = -1.5 * 1000 sldEndY.Max = 1.5 * 1000 Case mcintMandelBrot ' Set the range of values defined for the Mandelbrot set sldCX.Enabled = False sldCY.Enabled = False sldStartX.Min = -2.25 * 1000 sldStartX.Max = 0.75 * 1000 sldStartY.Min = -1.5 * 1000 sldStartY.Max = 1.5 * 1000 sldEndX.Min = -2.25 * 1000 sldEndX.Max = 0.75 * 1000 sldEndY.Min = -1.5 * 1000 sldEndY.Max = 1.5 * 1000 End Select End Sub
The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.
Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!
Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!
"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."
Van T. Dinh, Microsoft MVP