Does MSFlexGrid have a property or method so that I can
set different color for one cell and another color for another cell? Please help! Thank you...
Printable View
Does MSFlexGrid have a property or method so that I can
set different color for one cell and another color for another cell? Please help! Thank you...
you can use the MSHFlexGrid1.CellBackColor properties to do it.
For some reason I only have one cell colored. You have any
code? Thank you...
Hi there,Quote:
Originally posted by laura
Does MSFlexGrid have a property or method so that I can
set different color for one cell and another color for another cell? Please help! Thank you...
How can I save the back ground color of the cells and rows, even after I close the form?
That is, I want to retain the back color of the cells and rows
Is it possible? If so, pls tell me how?
Thanks in advance.
Rathi
Hi there.
I'm using public constants to 'remember' the background colors for the active cell and the last activated cell
Public Const CellLastColor as Variant ' Can't remember the right datatype
Public const CellDefaultColor = &HFFFFFF ' plain white
Public Const CellActiveColor = &H800000 ' vbBlue
Public Const CellNoteColor = &HEAD5FF ' shady pink ;-)
Since I have notes attached to some of the cells in the MSFlexgrid, I only needed to specify the note color and keep information in a list containing the row and coloumn where notes are attached.
Do you have specific colors for each cell that you need to save?
If you want all of your cells to have (except fixed cells)
the nice blue color use:
dim i as integer, j as integer
dim intFirstRow as integer, intFirstCol as integer
' non-fixed that is
dim intMaxRow as integer, intMaxCol as integer
intFirstRow = 1
intFirstCol = 1
intMaxRow = MSFlexgrid1.rows - 1
intMaxCol = MSFlexGrid1.cols - 1
for i = intFirstCol to intMaxCol
MSFlexGrid1.col = i
For j = intFirstRow to intMaxRow
MSFlexGrid1.row = j
' Insert update of your list if you want
' to save the previous Cell color
MSFlexGrid1.CellBackColor = CellActiveColor
' or MSFlexGrid1.CellBackColor = vbBlue
next j
next i
There you go
Regards Kishpa
Quote:
Originally posted by Iluvaras
Hi there.
I'm using public constants to 'remember' the background colors for the active cell and the last activated cell
Public Const CellLastColor as Variant ' Can't remember the right datatype
Public const CellDefaultColor = &HFFFFFF ' plain white
Public Const CellActiveColor = &H800000 ' vbBlue
Public Const CellNoteColor = &HEAD5FF ' shady pink ;-)
Since I have notes attached to some of the cells in the MSFlexgrid, I only needed to specify the note color and keep information in a list containing the row and coloumn where notes are attached.
Do you have specific colors for each cell that you need to save?
If you want all of your cells to have (except fixed cells)
the nice blue color use:
dim i as integer, j as integer
dim intFirstRow as integer, intFirstCol as integer
' non-fixed that is
dim intMaxRow as integer, intMaxCol as integer
intFirstRow = 1
intFirstCol = 1
intMaxRow = MSFlexgrid1.rows - 1
intMaxCol = MSFlexGrid1.cols - 1
for i = intFirstCol to intMaxCol
MSFlexGrid1.col = i
For j = intFirstRow to intMaxRow
MSFlexGrid1.row = j
' Insert update of your list if you want
' to save the previous Cell color
MSFlexGrid1.CellBackColor = CellActiveColor
' or MSFlexGrid1.CellBackColor = vbBlue
next j
next i
There you go
Regards Kishpa
Hi there,
Thank you very much for your support.
I could have been more specific about my question.
My form has MSHFlexgrid control and a Common dialog color control. I can color cells and rows using the dialog
control.
when I close the form, all the color settings are gone. How
can I retain this?
Your help would be greatly appreciated.
thanks
sincerely,
Rathi
Use the SaveSetting and GetSetting functions to save and retrieve the colors from the registry.
Look up the functions in MSDN for examples.
Hi there,Quote:
Originally posted by ttingen
Use the SaveSetting and GetSetting functions to save and retrieve the colors from the registry.
Look up the functions in MSDN for examples.
Thanks a lot for your time.
The savesetting function has four arguments. I tried to understand the parameters: Section, Key, and Setting for the whole day, but no use. Examples in MSDN did not help me.
How can I use this function, to save the color of the cells?
Your help would be greatly appreciated.
Thank you.
sincerely,
Rathi
Quote:
Originally posted by rathi
Hi there,Quote:
Originally posted by ttingen
Use the SaveSetting and GetSetting functions to save and retrieve the colors from the registry.
Look up the functions in MSDN for examples.
Thanks a lot for your time.
There are many cells through out the grid with different colors. Is it possible to save the color settings of all the cells using the savesetting and getsetting function ?
Your help would be greatly appreciated.
Thank you.
sincerely,
Rathi
Here's a tutorial on how to use the functions:
http://www.vb-world.net/articles/registry1/
If you click on registry on the left-hand menu you will see a couple of other tutorials that use the registry to persist user settings, etc...