Solved

Paint a row in Datagrid

Posted on 2002-04-28
5
582 Views
Last Modified: 2006-11-17
Hi Everyone,

How can i Paint a row in Datagrid ?

10x
0
Comment
Question by:mosheshitrit
5 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 100 total points
ID: 6974787
Hi Mosheshirit,

you can use a invisible pictur box and a snippet

Sub ColorRow(pic As PictureBox, grd As MSFlexGrid, _
iRow As Integer, iBackColor As Integer, Optional Clear As Variant)
'sText As String,iForeColor As Integer,
    Dim iCol As Integer
    grd.Row = iRow
    pic.ForeColor = QBColor(iForeColor)
    pic.BackColor = QBColor(iBackColor)
    For iCol = grd.FixedCols To grd.Cols - 1
        If IsMissing(Clear) Then
            grd.Col = iCol
            pic.Width = grd.ColWidth(grd.Col) + 50
            pic.Height = grd.RowHeight(grd.Row) + 50
            pic.Cls
            pic.Picture = LoadPicture("")
            pic.CurrentX = Screen.TwipsPerPixelX
            pic.CurrentY = Screen.TwipsPerPixelY
            'pic.Print sText
            Set grd.CellPicture = pic.Image
            'grd.Text = sText
        Else
            Set grd.CellPicture = Nothing
        End If
    Next
End Sub

from another coder(Yoram Shechori)

HTH:O)Bruintje
0
 

Author Comment

by:mosheshitrit
ID: 6975044
To bruintje,

Will i bw able to see painted row text ?

Maybe an API ?

Thanks
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6975192
had to test it first so

Private Sub Command1_Click()
  ColorRow Picture1, MSFlexGrid1, 1, 2, 13, "test"
End Sub

Sub ColorRow(pic As PictureBox, grd As MSFlexGrid, _
iRow As Integer, iBackColor As Integer, _
iForeColor As Integer, sText As String, Optional Clear As Variant)
   Dim iCol As Integer
   grd.Row = iRow
   pic.ForeColor = QBColor(iForeColor)
   pic.BackColor = QBColor(iBackColor)
   For iCol = grd.FixedCols To grd.Cols - 1
       If IsMissing(Clear) Then
           grd.Col = iCol
           pic.Width = grd.ColWidth(grd.Col) + 50
           pic.Height = grd.RowHeight(grd.Row) + 50
           pic.Cls
           pic.Picture = LoadPicture("")
           pic.CurrentX = Screen.TwipsPerPixelX
           pic.CurrentY = Screen.TwipsPerPixelY
           pic.Print sText
           Set grd.CellPicture = pic.Image
           grd.Text = sText
       Else
           Set grd.CellPicture = Nothing
       End If
   Next
End Sub

this will paint the cell and add the text added in the commandbuttonclick it's a complete function if you use hte clear it will clear out the cell, else it will use the colors and the text could be a variable of course

HTH:O)Bruintje
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7670397
Hi mosheshitrit,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bruintje's comment(s) as an answer.

mosheshitrit, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8092562
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now