CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: MS Flexgrid

  1. #1
    Join Date
    Apr 1999
    Posts
    5

    MS Flexgrid

    The following is the problem faced by me with MS flexgrid. I have to have any one of the three values (cross, tick and blank ) shown on click of any cell in an MS Flexgrid.

    case 1 :
    I have used the character "X" for the cross and tried using character corresponding to Value 65 in the font Marlett for the tick mark, which does not work and I dont see the tick mark on the cell.

    case 2 :
    I tried positioning bitmaps on the grid by using the BitBlt function to put a bitmap on the grid cell. The problem here is that after a bitblt the whole grid repainted bcos of which the previously placed bitmap is lost.

    case 3 :
    I tried using the picture related functions that MSFlexgrid provides. I was not able to properly do the same.



  2. #2
    Join Date
    May 1999
    Location
    Fremont, CA
    Posts
    10

    Re: MS Flexgrid

    Hi,

    Here is one of the method that I have used to put check box bitmap in MS Flex Grid Cell.

    1. Insert the MS FlexGrid control - along with it the CPicture Class will be inserted into your project.

    2. Create the bitmaps you want to insert - usingthe resource editor. In my case the IDs were
    IDB_CHECK, IDB_NOCHECK.

    3. Now add following member variables to the class which controls the grid. (It may be the view class or the Dialog class - In my case it was view ).

    CPictureHolder m_picUnCheck; //Uncheck bitmap
    CPictureHolder m_picCheck; //Check bitmap holder

    4. In the OnInitialUpdate (or OnInitDialog), add the code to load the bitmap. i.e

    m_picCheck.CreateFromBitmap(IDB_CHECK);
    m_picUnCheck.CreateFromBitmap(IDB_NOCHECK);

    5. Now map the click event to view (or dialog).
    You can set the bitmaps here

    m_grid.SetCellPicture (
    m_picCheck.GetPictureDispatch()
    )
    You can also do this based on row or col number.
    I am even checking what is the current bitmap in
    the cell by comparing the handles.

    hope this works

    bye
    surendra



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

Featured