DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    1

    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
    Location
    Alameda, CA
    Posts
    1,737
    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
    next

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

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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links