Draw lines, fill areas w diff. colors within grid cell
I have a procedure that draws a grid with, say, 10 * 10 cells on it. Rather than filling each cell with a distinct color, I want to further subdivide each cell with some lines and distinct coloring.
For example, I would like to have two lines running north-south so that the cell area is divided into three equal areas.
Could you give me any lead how to do this?
Below I enclose my subroutine BaseMapDraw that draws each grid cell.
' Draw each grid cell.
Dim lngX As Long: Dim lngY As Long: Dim lngXCentre As Long: Dim lngYCentre As Long
' Determine the row and column by looking at values of g_udtCell().
lngX = (g_udtCell(lngCell).lngCol - 1) * m_lngWIDTH + (m_lngWIDTH / 4)
lngY = (g_udtCell(lngCell).lngRow - 1) * m_lngHEIGHT + (m_lngHEIGHT / 4)
' 'Line' draws lines + rectangles on an object. 'B' causes a box to be drawn using coordinates to specify opposite box corners. 'F' fills box with same color.
frmBaseMap.picMap.Line (lngX, lngY)-Step(m_lngWIDTH, m_lngHEIGHT), , BF
' Draws black lines around each grid cell.
frmBaseMap.picMap.ForeColor = QBColor(0)
' Without space between cells.
frmBaseMap.picMap.Line (lngX, lngY)-Step(m_lngWIDTH, m_lngHEIGHT), , B
frmBaseMap.picMap.CurrentX = lngX + (m_lngWIDTH / 2)
frmBaseMap.picMap.CurrentY = lngY + (m_lngHEIGHT / 2)
code not tested:
for i = 0 to 2
"There are two ways to write error-free programs. Only the third one works."
Last Post: 08-12-2002, 10:40 PM
By Rob Teixeira in forum .NET
Last Post: 06-06-2002, 05:23 AM
By Luciano in forum VB Classic
Last Post: 06-05-2000, 05:34 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center