Control for viewing more images in C#? - c#

When the user clicks a button in my C# app I want to show him bunch of images so that he can pick one. I don't want to do it with file browser, I want him to be able to view little thumbnails of the images so that he sees what he is picking.
Is there any control I can use to do this?
Thanks

If you are refering to a WinForms control, I would recommend the free ImageListView control.
Works very well in my own real-world projects. Plus, the author is very responsive and the control seems to have a very high overall code and design quality.

You will need to create custom code. Or you can use a WYSIWYG Editor.
Here are 2 popular ones for .NET.
http://www.tinymce.com/
http://ckeditor.com/

Create multiple PictureBox-es in a grid formation in the form that you are creating.
Display one thumbnail in each PictureBox.
I am usually against PictureBox control usage, but in this case, you can't miss.

Related

WPF - Export XAML content to file (PDF or Word)

I have a pretty straightforward WPF application, but with a lot of forms, nearly 80, spread out to UserCcontrol xaml files and navigated with TabControl on a main Window file. Some of those forms contain a lot of data, but basically everything is broken down to TextBlock, TextBox, Label, Grid, RadioButton and ComboBox controls.
I am done with everything, but there is a requirement that everything at the end should be exported to a file - either PDF, or Word. Is there an easy way to do that? I don't have a requirement to have the same style and formatting. I only need the text - question and given answer, either text, or chosen option.
I have searched the web and saw many solutions, but PdfSharp was the best, I believe. However, I do have a lot of forms and it would be an overkill to map every single user control in a loop or something, to write to file. Creating a bitmap or an image and print to file would not help, since I have text boxes with scrolling and the whole text would not be visible in such cases.
What best would work for me would be a library that accepts, let's say, a user control and then prints its content on a page(s) of a file. Once again - I don't need any styling or formatting or images, just text.
Here is a small example of what one of the forms looks like, just to give you an idea:
Thank you in advance!
I've looked for similar tools and there isn't much out there, especially if you are looking for something open-source.
The most straightforward approach will be using tools found in the System.Windows.Automation namespace. That should help you write some helper functions that can capture text from all of the elements in your controls.
This link should be helpful:
https://learn.microsoft.com/en-us/dotnet/framework/ui-automation/obtain-text-attributes-using-ui-automation

C# Winform or WPF word-like page component

Does anyone know of a C# WinForm or WPFcomponent that I can use as a "Word-Blank-page" control?
I need that the my user at runtime see a whit-blank-page that can manipulate by having basic text editing (bold, fonts, color), basic tables and images placed everywhere on the "canvas" (the white page).
The component should give me an API, so I can react on user actions on the component, like when right clicking on table or an image (I will display different forms depending on the object clicked).
I look for some extension of the RichTextEdit control from different vendors, but any of those can give me the functionality I need.
Any suggestion is welcome.
Flow documents is a good way to go. They are thoroughly documented by Microsoft.
They provide all the functionality you mentioned and then some. Code Project has some good examples on how to use flow documents. You can check this beginners guide for starters.

How to create an image of a WPF UserControl at runtime

I've created a WPF application which has a Canvas on which I place UserControls which are moveable and resizeable by the user (just like a Windows-Window). Now I have detected that this can be very slow on older PC's which is a problem.
As a solution I thought about generating a graphic showing the UserControl and show this while resizing/dragging the Control, to prevent WPF from recalculating all Elements permanently. The only problem is that I have no idea how to generate this image.
Is there perhaps something like a function which does this in .Net? Or how could I do this on my own?
You can render a WPF control to a bitmap using RenderTargetBitmap, then this image can be copied to the clipboard, saved to a file, or used as part of your GUI
Check out Get a bitmap image from a Control view
Beware with this that you can hit problems when parts of the control you are trying to render are not visible (within a scroll viewer perhaps)
WPF applications really do require some fairly serious grunt; particularly in the graphics department and benefit greatly from having a decent video card present in the system. Even then the performance of WPF apps (if not carefully constructed) can leave much to be desired...
That said, you could feasibly use FixedDocument to rasterise a UserControl, and then convert this into a GIF/JPG/PNG and put this in place of the control being resized... however I would expect that process itself to be as slow or slower than your current observed performance issues.

C# Volume mixer like buttons/combo boxes

How would you get a button to look and perform similar to that of the buttons in the volume mixer on Win7?
What I mean is that in the volume mixer there are icons that doesn't look like buttons until you hover them, they also haven't got the standard blueish color when hovered.
So far I haven't found a way to do this directly in visual studio.
I'm guessing that creating a custom user control is the only way to go, but I've had no luck so far, I would appreciate some examples.
In addition, there are also combo boxes in the volume mixer I would like to duplicate. They're hidden except for the text and arrow until they're hovered.
Is there a way to accomplish this?
(Here an image that might help explain what I mean:
http://i53.tinypic.com/2ij409u.png)
For windows application, (and also how they did win7), they used the technology called WPF. I am not specifically answering how you can do this, because in WPF, this is the fundamental that defining skin (via markup called XAML) without touching the implementation code. If you are serious in learning how to do that, I suggest you look for tutorials or good book about WPF.
Here's one of the markup looks like for a button. To modify the button's look, what you need is to define it's XAML, and you don't have to inherit it in the code. The example looks scary long, but Visual Studio could help you.
You could use a third party control library, for example Krypton Toolkit, its free!
There is quite a terrific solution for this button quest. You can paste pictureBoxes on form and handle MouseUp, MouseLeft and MouseDown events. When each of them fires, you need to set specific image (one of tree, in fact) - normal picture, picture of "highlighted" icon and picture of pressed icon. But that's really a hard and useless work, so better don't.
If you need several of such "buttons" in a panel, I remember, I once managed to get the same behaviour by using toolStrip with buttons.

best way to show several images on a winform in c#

best way to show several images on a winform in c#? Datagrid?
Several PictureBoxes :-)
Left a treeview with all the images and mainform the image large? It's kinda hard to guess what you want...
My company, Atalasoft, has several win forms controls that can be used for displaying images and thumbnails.
There is a typical example of using the thumbnail control here.
It depends on how many images you want to display, do you want thumbnails or full-resolution images?
I'm going to assume that since you asked for "images", you have many images to display. As such, you'll probably be wanting to use thumbnails on that form, with a different form if you want to display the full-resolution image.
In this case, you'll want to look at the ImageList object in conjunction with the ListView object.
I used this solution in an app recently. It worked out very well.
You can try using an ImageList and binding it to a ListView. You can set the ListView to Tile View state or any other states.

Categories

Resources