Results 1 to 6 of 6

Thread: VSFlexGrid only picture in column and not text.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    VSFlexGrid only picture in column and not text.

    I maintain an old application who use vsFlexGrid. Grid is bound to a database and one field display 0 and 1 values. I try to replace this value with picture, so in AfterDataRefresh event i have this code:

    Code:
        With grid
            .Redraw = flexRDNone
            For f = 1 To .Rows - 1
                If .ValueMatrix(f, 2) = 0 Then 
                    .Cell(flexcpPicture, f, 2, f, 2) = imgHandleNOK
                Else
                    .Cell(flexcpPicture, f, 2, f, 2) = imgHandleOK
                End If
                .Cell(flexcpPictureAlignment, f, 2, f, 2) = flexAlignCenterCenter
            Next f
            .Redraw = flexRDDirect
        End With
    ... but grid display image and textvalue from database.
    Name:  2024-03-27_111131.jpg
Views: 138
Size:  44.6 KB

    I can't use
    Code:
    .ColImageList(2) = imgList.hImageList 'handle to an ImageList
    because image are stored in a ImageManager control from Codejock Activex and the control doesn't deliver the handle. I obtain one by one image using this code:
    Code:
        Dim imgHandleOK As StdPicture, imgHandleNOK As StdPicture
        Set imgHandleOK = ImageManager.Icons.GetImage(1, 16).CreatePicture(xtpImageNormal)
        Set imgHandleNOK = ImageManager.Icons.GetImage(2, 16).CreatePicture(xtpImageNormal)
    ...so can i display only image in column?
    Last edited by cliv; Mar 27th, 2024 at 04:36 AM.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,747

    Re: VSFlexGrid only picture in column and not text.

    And what if you set .TextMatrix to ""
    Code:
    With grid
            .Redraw = flexRDNone
            For f = 1 To .Rows - 1
                If .ValueMatrix(f, 2) = 0 Then 
                    .Cell(flexcpPicture, f, 2, f, 2) = imgHandleNOK
                Else
                    .Cell(flexcpPicture, f, 2, f, 2) = imgHandleOK
                End If
                .Cell(flexcpPictureAlignment, f, 2, f, 2) = flexAlignCenterCenter
                .TextMatrix(f, 2) = ""
            Next f
            .Redraw = flexRDDirect
        End With

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: VSFlexGrid only picture in column and not text.

    Quote Originally Posted by Arnoutdv View Post
    And what if you set .TextMatrix to ""
    Doesn't work ... maybe because grid is bound.

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,747

    Re: VSFlexGrid only picture in column and not text.

    Is there a specific reason for having the grid bound to a dataset?
    In other words can it be disconnected?

  5. #5
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    235

    Re: VSFlexGrid only picture in column and not text.

    Quote Originally Posted by cliv View Post
    I maintain an old application who use vsFlexGrid. Grid is bound to a database and one field display 0 and 1 values. I try to replace this value with picture, so in AfterDataRefresh event i have this code:

    ...so can i display only image in column?
    -----------------------------------------------
    Hi
    The best case is to hide the field from which you get the information and assign the image to a new field.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: VSFlexGrid only picture in column and not text.

    Quote Originally Posted by Arnoutdv View Post
    Is there a specific reason for having the grid bound to a dataset?
    In other words can it be disconnected?
    as i say it's and old application written more than 20 years ago with a lot of grid bound so change all involves a lot...

    Quote Originally Posted by Mojtaba View Post
    The best case is to hide the field from which you get the information and assign the image to a new field.
    ...yes it is a solution

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width