Solved

.HighLight = flexHighlightAlways Can this be changed to a specific color

Posted on 2006-11-25
4
455 Views
Last Modified: 2013-12-26
I am using the mshflexgrid and have the control highlight set to  flexHighlightAlways in properties.
It always highlights in grey however. Is there a way to get it to highlight in another color or to get the cell to highlight, or to even get the text color in the cell to change color while it has the focus?
This is an appointment book and it would make it much easier if the users were sure of which client they were on.
0
Comment
Question by:mindserve
[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
4 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 18011844
You could set the cell's BackColor property instead.
0
 
LVL 1

Author Comment

by:mindserve
ID: 18012286
What about flex focus heavy,, light, can these colors be changed?
0
 
LVL 3

Expert Comment

by:AbhishekSharma
ID: 18056838
Following code will highlight the selected row

'-----------------------------------------------------------------------
'Add MSHFlexGrid grid to a form and copy - paste following code and try clicking on rows
Dim LastSelectedRow As Integer
Private Sub Command1_Click()
MSHFlexGrid1.FixedCols = 0
MSHFlexGrid1.FixedRows = 1
MSHFlexGrid1.Cols = 3
MSHFlexGrid1.Rows = 0
MSHFlexGrid1.SelectionMode = flexSelectionFree
MSHFlexGrid1.AllowUserResizing = flexResizeColumns

'Add Header Row in Grid
MSHFlexGrid1.AddItem "S.No" & vbTab & "Candidate Name" & vbTab & "Mobile No"

'Add rows in Grid
MSHFlexGrid1.AddItem "1" & vbTab & "Candidate 1" & vbTab & "1111111111"
MSHFlexGrid1.AddItem "2" & vbTab & "Candidate 2" & vbTab & "2222222222"
MSHFlexGrid1.AddItem "3" & vbTab & "Candidate 3" & vbTab & "3333333333"


End Sub

Private Sub MSHFlexGrid1_Click()
    'Save current selected row number
    CurrentSelectedRow = MSHFlexGrid1.Row
   
    'Loop through all columns
    For i = 0 To MSHFlexGrid1.Cols - 1
        'Set column
        MSHFlexGrid1.Col = i
        'Make font bold of cell set in above statement
        MSHFlexGrid1.CellFontBold = True
    Next
   
    'Following code is for clearing the last selected row
    MSHFlexGrid1.Row = LastSelectedRow
    For i = 0 To MSHFlexGrid1.Cols - 1
        MSHFlexGrid1.Col = i
        MSHFlexGrid1.CellFontBold = False
    Next
   
    'update variable which will hold the current selected row no.
    LastSelectedRow = CurrentSelectedRow
End Sub
'-------------------------------------------------------------------------------------------------------
0
 
LVL 3

Accepted Solution

by:
AbhishekSharma earned 125 total points
ID: 18056872
Following code will change the font color and also make the fond bold

'-----------------------------------------------------------------------
'Add MSHFlexGrid grid to a form and copy - paste following code and try clicking on rows

Dim LastSelectedRow As Integer
Private Sub Command1_Click()
MSHFlexGrid1.FixedCols = 0
MSHFlexGrid1.FixedRows = 1
MSHFlexGrid1.Cols = 3
MSHFlexGrid1.Rows = 0
MSHFlexGrid1.SelectionMode = flexSelectionFree
MSHFlexGrid1.AllowUserResizing = flexResizeColumns

'Add Header Row in Grid
MSHFlexGrid1.AddItem "S.No" & vbTab & "Candidate Name" & vbTab & "Mobile No"

'Add rows in Grid
MSHFlexGrid1.AddItem "1" & vbTab & "Candidate 1" & vbTab & "1111111111"
MSHFlexGrid1.AddItem "2" & vbTab & "Candidate 2" & vbTab & "2222222222"
MSHFlexGrid1.AddItem "3" & vbTab & "Candidate 3" & vbTab & "3333333333"


End Sub

Private Sub MSHFlexGrid1_Click()
    'Save current selected row number
    CurrentSelectedRow = MSHFlexGrid1.Row
   
    'Loop through all columns
    For i = 0 To MSHFlexGrid1.Cols - 1
        'Set column
        MSHFlexGrid1.Col = i
        'Make font bold of cell set in above statement
        MSHFlexGrid1.CellFontBold = True
        MSHFlexGrid1.CellForeColor = &H8000000D
    Next
   
    'Following code is for clearing the last selected row
    MSHFlexGrid1.Row = LastSelectedRow
    For i = 0 To MSHFlexGrid1.Cols - 1
        MSHFlexGrid1.Col = i
        MSHFlexGrid1.CellFontBold = False
        MSHFlexGrid1.CellForeColor = &H0&
    Next
   
    'update variable which will hold the current selected row no.
    LastSelectedRow = CurrentSelectedRow
End Sub
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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