Solved

Paint a row in Datagrid

Posted on 2002-04-28
5
581 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
Comment Utility
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
Comment Utility
To bruintje,

Will i bw able to see painted row text ?

Maybe an API ?

Thanks
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
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
Comment Utility
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
Comment Utility
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now