Solved

MSFlexGrid - how can I format grid lines?

Posted on 2008-10-27
4
990 Views
Last Modified: 2013-11-28
I am developing an application and am using a flexgrid control to display data.  This is not bound to data but is being loaded and modified in code.

What I really need is to control how the grid lines apparently look, for example I'd like a thicker horizontal line between each two rows.

I know that the grid lines in the control do not offer this functionality and I've tried simulating the effect by using either a line control or a picture box control and positioning it on top of the grid in the appropriate place.

Unfortunately, it would appear that the grid always appears on top of everything else and so these controls cannot be seen!

How can I take control of the way specific grid lines appear?

What I've done so far is to have some extra rows of small height and with the required background colour but it's hardly satisfactory and requires quite a lot of extra programming to ensure that the mouse clicking on, or the cursor keys moving into, these 'fake' cells are handled.
0
Comment
Question by:trentham
  • 2
  • 2
4 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22819590
trentham,

Are you even sure this is even possible?

Why not just alternate the row color?
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_10207284.html

JeffCoachman
0
 

Author Comment

by:trentham
ID: 22819992
I'm NOT sure that this is possible which is why I've posted the question to a wider audience!

Someone may have a definitive answer as to whether another control can be seen ON TOP of one of these grids.  There are suggestions that VB6 can do this but none of those approaches have worked with VBA in MSAccess.  For example, an approach that is used to make a cell apparently editable is to overlay an edit control on it ... but in this app, it always seems to get hidden by the grid!

Unfortunately the more obvious approach of alternating row colour is not ideal.  The colours of rows indicates various other things.  This is a booking calendar and the two connected rows indicate daytime and evening for each room.  The background colour is used to indicate whether it is; normally available, not available, already booked, etc, etc. - although I've not ruled this approach out entirely!

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22822568
OK,

Good luck with this!
;-)
0
 

Accepted Solution

by:
trentham earned 0 total points
ID: 22874719
OK, it seems that what I want is probably not possible so the following is an outline of my workaround.

In order to apply apparent horizontal grid lines of a different colour I inserted extra rows, one per gridline, and set them to have a low heigh valuet.  Providing the background colour of that row then gave me the visual effect I was after.  I refer to these cells as 'gridline cells'.

However this causes a number of inconveniences and there are things to handle:-

1. It's a bit more awkward now because if I want row 7, say, there may be grid lines to add in to fnd out that it is really row 10 now!  There are lots of ways to handle this, including a simple mapping function.

2. In my grid, the user can click on a cell.  It is just as possible for them to click on one of these gridline cells and then the cursor appears to vanish!  I recognise this and also keep track of what cell they were in last.  When they click on such a gridline cell they are repositioned to either the one above or the one below where they clicked, depending on where they were last.

3. In my grid the user can move around wth the cursor keys.  It's a simple matter when up or down cursor is used and a gridline cell is landed on to 'bump' the focus into the next cell.

It's not a tidy solution but it gives me what I want!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question