Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MSFlexGrid - how can I format grid lines?

Posted on 2008-10-27
4
Medium Priority
?
1,007 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

688 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