DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005

    Draw lines, fill areas w diff. colors within grid cell

    Hi there:

    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?

    Thank you.

    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)

  2. #2
    Join Date
    Nov 2003
    Alameda, CA
    code not tested:

    for i = 0 to 2
    ...Line (lngx+i*m_lngWIDTH/3,lngy)-step(m_lngWIDTH/3,m_lngHEIGHT),colorofcell(i),BF
    ...Line (lngx+i*m_lngWIDTH/3,lngy)-step(m_lngWIDTH/3,m_lngHEIGHT),colorofborder,B

    "There are two ways to write error-free programs. Only the third one works."

Similar Threads

  1. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 10:40 PM
  2. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 05:23 AM
  3. Replies: 5
    Last Post: 06-05-2000, 05:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.