wsResults.Cells(7, 6).
Value = "Solver: " & solverType
' Auto-fit columns and apply formatting
wsResults.Columns("A:Z").AutoFit
wsResults.Range("A1:A1").Font.Bold = True
wsResults.Range("A1:A1").Font.Size = 14
' Notify user
MsgBox "Analysis complete. Results written to 'Results' worksheet.",
vbInformation
End Sub
Sub UpdateDeformedShape(displacements() As Double)
' Update visualization with deformed shape
Dim frm As Object
Set frm =
ThisWorkbook.VBProject.VBComponents("EnhancedStructuralAnalysis").Designer
' Get the image control
Dim img As MSForms.Image
Set img = frm.Controls("imgStructure")
' Create a temporary picture
Dim pic As StdPicture
Set pic = CreatePicture(730, 270)
' Draw the structure (original and deformed)
Dim hdc As Long
hdc = GetDC(img.Picture.Handle)
' Draw original structure (black)
Dim hPen As Long, hOldPen As Long
hPen = CreatePen(0, 1, RGB(0, 0, 0))
hOldPen = SelectObject(hdc, hPen)
DrawStructure hdc, False ' Original
' Draw deformed structure (red)
hPen = CreatePen(0, 2, RGB(255, 0, 0))
SelectObject hdc, hPen
DrawStructure hdc, True, displacements ' Deformed
' Clean up
SelectObject hdc, hOldPen
DeleteObject hPen
ReleaseDC img.Picture.Handle, hdc
' Assign the picture to the image control
Set img.Picture = pic
End Sub
Sub DrawStructure(hdc As Long, showDeformed As Boolean, Optional
displacements() As Double)
' Draw structure (original or deformed)
' ... [implementation using API calls]
End Sub
' Helper functions
P a g e 60 | 62