DataGridView Image Layout Stretch Bug - c#

I'm using a DataGridView to display some data, including an image which I'm displaying in an "Image Column". To display the image properly, I set the Image Layout property to Stretch; however, I'm getting an unexpected visual effect when I click on a row or I scroll (up-down, left-right).
When I scroll, it look like the background keep a "picture" of the
movement.
When I click, the background seems to stack.
Given that I set the Image Layout property at design time, I thought the way I set it created this bug. So I tried to set the property at run time, but I had no luck.
Then I started to think it was probably another property set with "Image Layout:stretch" that can make this issue. I tried to find the property, but I found nothing to fix it.
I did not show code because I don't think it is pertinent in my situation. But if you think it is, let me know and I will post what you want.

I think you are using a transparent background image(like .png image format) that ways you are facing that type of problem.
Another issue is may be you have low graphics in your system.

Related

What keeps Views/UIViews from being drawn outside their ViewCell/UITableViewCell

I'm trying to replicate Instagram's zoom feature on their list of videos on iOs using xamarin.forms.
I have a xamarin.forms ListView (actually a modified FlowListView) and I've been successful for the most part except for the fact that when I'm zooming, the zoomed view (an AVPlayerViewController) zooms fine but cannot extend beyond the size of the cell that contains it so it gets clipped. The effect is achieved by a simple UIPinchGestureRecognizer and UIPanGestureRecognizer and applying the appropriate Transform/Scale using CGAffineTransform.
You can see the problem here
From what I understand, the clipsToBounds property is what keeps views confined to their parent's frame so I tried:
setting clipsToBounds to false (even though that's supposed to be the default value) in the renderer and recursively to all the views' .Parent properties.
setting it to false in the default ViewCell renderer.
setting Xamarin's IsClippedToBounds to false at the xaml level.
Instagram also seems to blur the background of the zoomed video (as it is being zoomed) which would indicate that they've somehow moved the video view out of the cell and into some other temporary fullscreen view.
So I'm looking for some general guidance; is my understanding of clipsToBounds wrong? What is keeping the view from being drawn outside of its UITableViewCell? Should I approach this from a different angle? I'm at my wits' end, thanks in advance.

How to get image control color using C# or Coded UI?

I have one green checkmark (an image control). I have to verify that the checkmark is green. I am not able to get the color. Can you help me?
Coded UI is about checking the functionality of an application. It is not so good at checking the aesthetics (ie colour, size or fonts).
Rather than check the colour can you check some other feature of the UI control for the image? If the green image is not shown then what is shown instead? Try using the crosshairs tool to inspect the green image and also to inspect any other images shown in the same place. Hope to find some properties to distinguish the green image from the others.
You could request the developers to add some distinguishing features. If they do not want to then ask them how a screen reading program for sight impaired people would be able to tell the difference between the images.
For checking colours of UI controls you could capture and image of the controls and then examine the colours used in the image. To get the image use code based on
Image img = this.UIMap.UIYourApplicationsWindow.UISubWindow.UISubSub.CaptureImage();
When testing an application with a page save message, we had an error message that was always there, but was either colored red or not to make it visible or not. I found that the filter property controldefinition had reference to the color of the control. Could you look to see if the color is mention in any of the properties? If not AdrianHHH's answer is your best bet with coded ui.
Sikuli could compare the image if you want to run a little sikuli script from your coded ui test.

C# Winforms Custom control help

I am looking for a free control in C# which allows me to show a set of images in a List like a preview (Eg PDF pages preview). I tried ListView control but it does not allow me to set bigger image size. Please advice
You can use a ListView-ImageList combination to achieve that purpose.
Just set the ImageList's ImageSize property to something large, say 96, 96 and set the ListView's LargeImageList property to the ImageList.
Have you tried using a repeater?
here's a link returned on the first page of a quick google search that demonstrates one way to do this: http://www.vbknowledgebase.com/?Id=157&Desc=Asp.Net-Image-Dropdownlist
There is the ImageListView control. (I am the owner of the project.)
How about a Panel with images in it? You can set it up to render as a scrollable div (if you're targeting ASP.NET, which I think you are), or if this is WinForms, you just set it to have scrollbars.
Understand, though, that unless you have pre-made thumbnails for your images, showing a preview of the image will require loading the whole image and downsizing it to show as a thumb. So, except for the real estate it will take, you may not be saving much by "previewing" images.

.Net Windows Forms ListView OwnerDraw LargeImageList leak

I'm ownerdrawing .Net Windows Forms ListView control and see a very strange bug/behavior when I need to draw an image from the associated LargeImageList.
When the View type is a type where LargeImageList is used (Tile, LargeIcon, etc.), I draw item images from the LargeImageList. At that condition, I see a huge memory increase and when you try to scroll ListView this becomes more obvious as you see a jerky scroll as well. This same thing does not happen when the same code uses SmallImageList which is simply like this :
Image MyImage = this.LargeImageList.Images[MyIndex];
e.Graphics.DrawImage(MyImage,MyLocation);
This is reproducable under XP and 7 according to my tests. Is this a known bug, any workaround?
Regards,
Ă–zden
Although I still think this is a bug, I found a workaround. If you draw using ImageList.Draw instead of e.Graphics.DrawImage this problem seems to go away.
How are you managing the invalidated drawing area? As you are saying, looks like you are "overdrawing" the control, I mean, drawing even when it is not necessary.

C# ListView: ListViewItem offset possible?

I was wondering... I have a WinForms System.Windows.Forms.ListView with a bunch of ListViewItems that I'm drawing using the View.List style. Each ListViewItem has a "SmallIcon" that I fetch from the ListView's SmallImageList.
My problem is that the icons are showing too close to the border on the left. I've tried to change the bounds and the ListViewItem's Position property to no avail.
Is there anyway to have some kind of offset to ListViewItems?
The Win32 listview control doesn't have any setting to increase the space between the icon and the label (in any view, not just List). Setting ListViewItem.Position does nothing when the ListView is in List view.
A low-tech solution would be to simply prefix every ListViewItem's Text value with a single space. Slightly ugly, but oh so easy to do.
If you really want to have pixel level control, you will have to owner draw it. As always, if you are doing anything with a .NET ListView, ObjectListView makes owner drawing your items trivial.
As mentioned already, prefixing the text of all your items with a space is a super simple way to add padding. This has a pretty significant drawback, however. Once you do this, you lose the ability to find items in the ListView by simply starting to type their name while the ListView has focus.
Try adding white space to the left of your small images.
If you're using 16x16 images change to 24x16 for example by adding 8 white (or ListView Background color) pixels to the left.
If you are in ListView View LargeIcons then you can postion the text using item.position
A screenshot would be nice for an example to see exactly what you're after.
Funny thing... the Windows Explorer uses the ListView to display files and folders. i usually run my view in Report or Detail mode. i just switched it to List view mode and see the exact problem that you're describing! Yikes. Might be a bug with the Win32 object and that particular view type!
A quick workaround might be to use a Report style for the ListView with a single column or perhaps implement something yourself. The FlowLayoutPanel in .Net would work very nicely as a starting point for a custom list view.
As you are using the View.List style, I suspect you'll either need to implement some custom drawing or consider padding your images. You could also look at overriding the ListView control and manipulating it's bounds by overriding SetBoundsCore or SetClientSizeCore (or similar).
However, if the ListView were set-up for View.Details view, this could be done using the ListViewItem.IndentCount property:
The IndentCount property can be used
only when the View property of the
containing ListView is set to Details,
and the SmallImageList property of the
ListView is set. Source:MSDN
If you set the StateImageList property you can add a space of 16 px before the icons. I think you can adjust this additional space by loading an image with matching width as first entry into the StateImageList. But I have not tested this.
This thread discusses the opposite problem.

Categories