Home Forums WinForms controls Xceed Grid for WinForms Disappearing Background Image when selected…

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16059 |

    I’m currently trying to place a grid control w/in a cell, much like any other control in a grid, by inheriting from CellViewerManager and overriding the SetControlValueCore method.  I would like to put an image on the left side of the cell.  I am currently using the cell’s background image and the background image alignment properties to achieve this.  Generally, this works well expect in the case when the row is selected in which the image is not longer visible.  Cell with the grid is not the current cell.

    I’ve read in one of the forum entries that when using a CellViewerManager with a control, GetImageCore is not call.  That’s why I opted to use the background image.

    Since using a grid is slightly complex, I attempted to simplify the problem by using the stock CheckBoxViewer and setting the background image and image alignment.  The result is the same. How can I maintain the visibility of the image even when the row is selected?  If there is another way, how could this be done?  I’m open to the correct way to do this or any workaround that is available.

     Thanks, ac

    Imported from legacy forums. Posted by ac (had 622 views)

    User (Old forums)
    Member
    Post count: 23064

    Oh, I am using version 3.6. ~ac

    Imported from legacy forums. Posted by ac (had 246 views)

    Xceed Support
    Member
    Post count: 5658

    The problem here is that you are using BACKGROUND image, image style, etc. The Grid is painting the selected “context” after and on top of it.

     

    You need to create a CellViewerManager, and set ImageArea, ImageAlignment, ImageStyle and possibly ImageSize. If there is no ImageArea, the GetImageCore() method will never be called.

     

    By setting those properties, GetImageCore will be called and will return the wanted image and everything should work fine, the selected “context” not being painted on top of it.

     

     

    e.g.,

     

    public class MyCellViewerManager : TextViewer

    {

      public MyCellViewerManager()

      {

        this.ImageArea = ImageArea.Left;

        this.ImageAlignment = ViewerImageAlignment.MiddleLeft;

     

        this.ImageStyle = ImageStyle.Align;

      }

     

      protected override string GetTextCore( object value, CellTextFormatInfo formatInfo, GridElement gridElement )

      {

        return base.GetTextCore( value, formatInfo, gridElement );

      }

     

     

      protected override Image GetImageCore( object value, CellImageFormatInfo formatInfo, GridElement gridElement )

      {

        return new Bitmap( @”D:\test.jpg” );

      }

    }

    Imported from legacy forums. Posted by CharlesB (had 852 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.