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
Solved

Paint a row in Datagrid

Posted on 2002-04-28
5
584 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

856 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