Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Paint a row in Datagrid

Posted on 2002-04-28
5
Medium Priority
?
588 Views
Last Modified: 2006-11-17
Hi Everyone,

How can i Paint a row in Datagrid ?

10x
0
Comment
Question by:mosheshitrit
[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
5 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Suggested Courses

618 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