Hi, Using VB6, I need to change color of a 'Grid' I have coded under 'Declarations.
This color change notification needs to come from a listbox on my form.
I need to reference my 'Dim NewGridColorReq uested' to tell the grid to now be drawn in new selected color from the list box color selected.
My Grid Code:
This color change notification needs to come from a listbox on my form.
I need to reference my 'Dim NewGridColorReq uested' to tell the grid to now be drawn in new selected color from the list box color selected.
My Grid Code:
Code:
'Draw Grid Public Sub DrawGrid(GridSize As Single) Dim OldDMode As Integer, OldDSize As Integer, CX As Single, CY As Single Dim GridSpan As Integer Dim ColNumberName Dim GridCircleColors OldDMode = Document.DrawMode MousePointer = 11 DoEvents Document.DrawMode = vbInvert OldDrawSize = Document.DrawWidth Document.DrawWidth = 1 GridSpan = CInt(GridSize * 1440) CY = GridSpan CX = GridSpan ' Column = 0 ' Put to start naming/numbering my columns Rows = Int(Document.ScaleHeight / GridSpan) For Row = 1 To Int(Document.ScaleHeight / GridSpan) Cols = Int(Document.ScaleWidth / GridSpan) For Col = 1 To Int(Document.ScaleWidth / GridSpan) Document.PSet (CX, CY) CX = CX + GridSpan ' Next CX = GridSpan CY = CY + GridSpan Next Document.DrawMode = OldDMode Document.DrawWidth = OldDrawSize MousePointer = 0 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ColsTotal = Cols DrwX = 0 DrwY = 0 BeepCount = 0 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' START Naming my GRID in loop sample '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' NamedNumber = 0 ' frmMDIMainPage ListCordsNamed For Outer = 0 To Cols DrwX = DrwX + 120 For Inner = 0 To Rows DrwY = DrwY + 120 Document.Circle (DrwX, DrwY), 9, RGB(255, 0, 255) Next Inner DrwY = 0 Next Outer End Sub My List box code" '''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''Grid Color ''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub List2_Click() Select Case List2.Text Case "Black" Document.Cls DrawGrid GridPix ' frmElectronicPageChild.DrawGrid as ' I named my Form1 as frmElectronicPageChild 'NewGridColorRequested = RGB(0, 0, 0) ' This colors the circle used as the grid points Case "Red" Document.Cls DrawGrid GridPix GridCircleColors = RGB(255, 0, 0) Case "Green" Document.Cls GridCircleColors = RGB(0, 255, 0) DrawGrid GridPix Case "Yellow" Document.Cls DrawGrid GridPix GridCircleColors = RGB(255, 255, 0) Case "Blue" Document.Cls DrawGrid GridPix GridCircleColors = RGB(0, 0, 255) Case "Magenta" Document.Cls DrawGrid GridPix GridCircleColors = RGB(255, 0, 255) Case "Cyan" Document.Cls DrawGrid GridPix GridCircleColors = RGB(0, 255, 255) End Select End Sub
Comment