ListView Right-to-Left Mode Images Problem [duplicate] - vb.net

I have a ListView. Its RightToLeft property is set to Yes and its RightToLeftLayout is set to True. The ListView is populated with files in a directory.
In my code, I get the appropriate icon of a file using System.Drawing.Icon.ExtractAssociatedIcon(string filePath) and assign it to the file. This means that the icon come directly from the operating system. I do not have a directory with custom icons.
So the result is this:
As you can see, the PowerPoint file icon is flipped. When I change the layout to LeftToRight it is shown perfectly. How can I fix it?
Thanks.

If you only need the icon to be reversed, I suggest putting it into a Bitmap then using the Bitmap.RotateFlip you can flip it horizontally.
Bitmap bm = System.Drawing.Icon.ExtractAssociatedIcon(string filePath).ToBitmap();
bm.RotateFlip(RotateFlipType.RotateNoneFlipX);

Related

Allow user to resize window such that Gtk3 TextView component can't show all text

I'm working on a GTK program in Rust (someone can probably answer this if they don't know Rust, as I can figure out how to translate between different bindings and the native C API) via the gtk-rs bindings for which I want to have a non-editable TextView who's contents are constantly updated in my code. I want the user to be able to resize the TextView to any size, after which my code will re-calculate its contents accordingly. Unfortunately, GTK prevents any resize from taking place that would hide any contents that are current in the TextView. I can't use a ScrolledWindow because I don't want visible scrollbars, and disabling the scrollbars on a ScrolledWindow prevents the resizing behavior that I want. I also tried calling set_size_request to set the size to both 1, 1, and 0, 0 after every text change, but this does not change the behavior at all either — the user still can't properly resize the TextView (by resizing the window).
How can I enable the resizing behavior that I want?
Probably this is not possible. What would be the point of resizing the text view smaller, if the user can never see the text that is outside of the viewport because you don't want scrollbars? That seems like it would confound the user's expectation of how such a component would usually work.
Maybe an approach could be that you pick a certain number of lines to show, make that the size of the viewport, and delete the old contents of the text view that scroll outside of the viewport?

how to show vertical slider in [CodenameOne]

I want to show slider vertically in CodenameOne. Below is code which I tried to make it possible but still shows horizontally.
Code :
Slider s1 = new Slider();
Slider s2 = new Slider();
s1.setVertical(true);
s1.repaint();
s2.setVertical(true);
s2.repaint();
findContMainT2O(f).add(BorderLayout.EAST, s1);
findContMainT2O(f).add(BorderLayout.WEST, s2);
findContMainT2O(f).repaint();
see output image here
There is one more thing to do to make this work.
If you you look at the Slider and SliderFull styling, you could see that they have horizontal images. You will have to change this to vertical.
This is what I usually do if I want to reuse codename one slider images:
Go into my res folder and take the hd.png from these folders, depending on the theme you selected, In your case...
hd.png from sliderBlueCenter renamed to sliderBlueCenterV
hd.png from sliderBlueLeft renamed to sliderBlueBottom
hd.png from sliderBlueRight renamed to sliderBlueTop
hd.png from sliderEmpty renamed to sliderEmptyCenter
hd.png from sliderEmptyLeft renamed to sliderEmptyBottom
hd.png from sliderEmptyRight renamed to sliderEmptyTop
Then I rotate 90 degrees counter-clockwise these copied and renamed images and using Image manipulation software like Gimp or Photoshop.
Now I open my theme.res and add this images using Quick Add Multi Images and selecting all of theme and choose HD.
The next thing is manipulating my current slider styling, I double click the slider and switch to border tab. Click the 3-dots and choose Vertical Image instead of Horizontal Image. Change your images to the added images appropriately.
Do the same for SliderFull then copy these 2 styles from Unselected and paste them into Selected and Pressed to override those.
Here is a dropbox link to download slider images I manipulated earlier.

Scale image size (Image control on an Access form)

I've done this before, but I'm working in 2010 now and it doesn't seem to be working.
I'm trying to make a thumbnail view of an image control. The pictures I store (text field, just linking to a directory) are large and have their own form to open and view them at resolution, but I want to display a small thumbnail of the picture.
I have an image control with the control source set to the image field of my record source. It changes fine with I navigate records, but it shows a zoomed "window" of the image instead of scaling the image down to a thumbnail like it worked in the past.
I've tried the "size to fit" option, thinking that would do the trick but it doesn't.
Is there a different property that I could use? I don't mind writing a little VBA for this either, but I figured it would have worked by just using the form controls.
I just tried this using a regular old Image control in Access 2010 and it worked fine for me when I changed its dimensions to something "thumbnail sized" (0.5" x 0.5") and set the Size Mode property to Zoom.

Positioning Image and Text in a button

I have a Button on my Form. I want to have an image on the left and text on the right like :
Image Text
But the problem is that image is not stretched here. I mean it does not fit the button.
So I tried to set the BackGroundImage Property instead of Image Property.
Now I get the Image stretched. But I cant get the proper Format. I mean now I cant get Image on the left and Text on the right.
Is there any other control which I can use instead of button to Overcome this problem?
The button has a TextImageRelation property, set it to ImageBeforeText. Set the Image property with your image and there you go.
I don't think using stretch will in any case. How is it supposed to determine the border to stretch to?
With the imagealign set middleleft and the textalign set middleright I was able to make this button, it's 82X48. The image I used is 52X39. I used paint to resize the image.
A simple method that may work out good is to put both an image and button inside a panel. This gives you the flexibility of text placement, image scaling and use anchor or dock options to size the controls with the panel and form. Not tested but sounds like it could work...
If you used Button control .. and you want to add image to it
Create New Button and do domething in it's properties
Image : you can insert an image from anywhere (local or resource)
ImageAlign : Set it to Middle Left
TextAlign : Set it to Middle right
It tested on VB.NET 2005
To change a button's image size, you can use the image property . Your image will be resized to you specific dimension
Button2.Image = Image.FromFile("c:\image.jpg").GetThumbnailImage(20, 20, Nothing, IntPtr.Zero)

How to fix all my images being render black?

All my images are rendering black. The output of my animation is a .mpg video. The images themselves were created in GIMP and saved as non-transparent .png's.
Can anyone suggest anything?
If you go to the properties menu (Shift-F7), and then click on the materials tab, there you should check the 'shadeless' box.
Go to the properties menu (SHIFT + F7) and change the emit value under the shading category to a value in the range 0 and 1. Then gradually change this emit value to get expected shading of the object. To do so you have to render the view several times. In this way you can also retain the realistic 3D nature of the object.