[CLOSED] Datagridview placing Images via cell.style.backgoundimage not working properly

Closed
0
0

Hi

Set image by cell.style backgroundimage
=> the background images are not shown in the cells that are visible on start, only in the cells not visible on start, after scroll down the background images are visible
=> the positioning of the images is not working properly:
cell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
cell.Style.BackgroundImageAlign = ContentAlignment.MiddleCenter;
cell.Style.BackgroundImageLayout = ImageLayout.Zoom;
the images are always positioned at top of the cell

 

  • You must to post comments
0
0

Hi Luca

for reproduction of the drag drop problem, see the attached project. Column2 in the datagridview has mixed contents with text and images. DragDrop works well as long as you begin drag within a cell “outside” of the image area. As soon as you drag the image dragdrop doesn’t work anymore.

  • Luca (ITG)
    Hi Guenter. img elements are draggable by default in all new browsers and once the dragging starts it’s entirely managed by the browser. You have to add draggable=’false’ to the img element to disable independent dragging.
  • Guenter Roessler
    Hi Luca the point is that the dragging of images managed by the browser and the dragging of wisej interfere, with a little bit strange user experience. And setting draggable=false is not always a good way, especially if you have a lot of data
  • You must to post comments
0
0

WJ-7809: Bug: Cached rows in a DGV control may lose the background image when retrieved from the cache.

WJ-7810: Enhancement: Add ImageLayout.BestFit and ImageLayout.OriginalSize.

Let me know about the drag&drop issues, I can’ reproduce that one.

Thanks,

Luca

 

  • Guenter Roessler
    Hi Luca as long as you start dragging a cell in Column1 in the area outside the image everything works fine. But when you begin drag within the image, you can drag the image, which looks very nice. But the DragStart event is triggered on drop with strange mouse positions, and the Drop event is never fired. It looks as if the standard dragdrop of the browser is started when you drag an image inside a datagrdiviewcell
  • You must to post comments
0
0

Yes, I see. The problem is that the theme sets the background image at 24px 24px because of svg icons, otherwise svg icons are all quite big when using their natural dimension. The BackgroundImage property was added originally to support icons in cells. I have to see if we can override the theme without having to create a mixin under a combination of properties that makes sense.

About the other issues:

  • drag & drop is working find with the sample you sent, what error do you get?
  • I can reproduce the problem with the images not being rendered.

 

Logged both issues.

Thanks,

Luca

  • You must to post comments
0
0

Hi Luca

But then the ascpect ratio of the image is not properly displayed as you see in Column2, Column1 (with AllowHTML=true and a image url, but then DragDrop does not work) shows the image properly.

And the other problem with the background image not shown in the first screen, you dont’t see? Pleas have a look on the attached screeshot

  • You must to post comments
0
0

It seems to work well. The problem is that you can’t zoom and center at the same time. I tried your sample, commented out the zoom line and this is what I get using MiddleCenter:

 

  • You must to post comments
Showing 5 results