Solved

Flexgrid font color per column

Posted on 2000-04-27
6
689 Views
Last Modified: 2013-12-02
Is it possible to set the font color per column in a flexgrid? Or maybe even let the characters be transparent?
0
Comment
Question by:mawe
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2755443
I don't know about the charecters being transparent but its very easy to set the font color of a cpecific row or a cell in that row to a different color. Here is the example. It sets every other row to another color.I took this from my project so it uses database to populate it. It sets every other row to a specific color. Also if the value in one of my Cells was less then a specific date it would set the color of that cell to another color. If you won't understand something ask. Anyhow you have to use CellBackcolor and CellForecolor properties to set the backcolor and forecolor of the cell to another color. Best of luck.

Do Until rsUser.EOF
         I = I + 1: .Row = I
         J = -1
         For Each fld In rsUser.Fields
             DoEvents       'Process Other Events
             J = J + 1
             If .Row Mod 2 Then
                .Col = J: .CellBackColor = vbGreen
             Else
                .Col = J: .CellBackColor = vbWhite
             End If
             If J = 4 And rsUser!Returned = "False" Then
                If Date > CDate(fld) Then
                   .Col = J
                   .CellForeColor = vbRed: .CellBackColor = vbYellow
                End If
             Else
                    .Col = J: .CellForeColor = vbBlack
             End If
             .TextMatrix(I, J) = fld
         Next fld
         IBar.CurrRecord = I
         rsUser.MoveNext
Loop
0
 
LVL 6

Expert Comment

by:Marine
ID: 2755448
take away IBar.CurrRecord away from the code.
0
 

Author Comment

by:mawe
ID: 2755517
Ok, let me refrase. I need some of by columns in my flexgrid to be invisible to the viewer. My first thought was to set the fore- and back color to the same value. However, setting individual columns as unvisible would be a lot better. So how do I do that? There is a method called ColIsVisible which returns a boolean so it should be possible!
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 2755672
mawe:

The .ColIsVisible property relates to whether the column is in the visible area of the grid, not to the left or right of the columns you can see.

The easiest way to hide a column would be to set its width to 0;

MSFlexGrid1.ColWidth(3) = 0

for example.
0
 

Author Comment

by:mawe
ID: 2758187
Ok, let me refrase. I need some of by columns in my flexgrid to be invisible to the viewer. My first thought was to set the fore- and back color to the same value. However, setting individual columns as unvisible would be a lot better. So how do I do that? There is a method called ColIsVisible which returns a boolean so it should be possible!
0
 

Author Comment

by:mawe
ID: 2758193
Thanks Tim, that works fine by me!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

774 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