I'm making an application in which I need to print a content of the wpf richtextbox to an image, my application requires extremly fast perfomance, so the solution which uses WinForms RichTextBoxPrintCtrl (my own class with Handle on the control itself) with overlay, works way too slow for me, is there any way i can make a printable(saving as an image, or renderable to Bitmap) wpf richtextobx?
check these links hope help :
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx
http://www.codeproject.com/Articles/103184/How-to-Render-Bitmap-or-to-Print-a-Visual-in-WPF
http://www.west-wind.com/weblog/posts/2007/Sep/10/Rendering-a-WPF-Container-to-Bitmap
Related
I am about to write a main menu for a Windows Forms application.
Rather than trying to explain my goal with a wall of text i made a quick(ugly) paint sketch:
As you can see here i want the Group Controls to automatically scale with their content(similar to the wrap_content attribute in android) and fit underneath each other if possible.
If anyone knows how to achieve this or even has a sample where he already did achieve it, that would help me massively!
thanks, Felix.
I've got this problem:
I created a pretty large Canvas in WPF with a lot children.
I want to add a Print Button. PrintVisual seems not to work, because the image is to big. (I am using a scrollbar) I want to split the Canvas between multiple pages.
What i've done so far:
I am taking a Visual Brush for every part of the Canvas
Create a new Canvas and make the visual brush its background
Adding the new Canvas to a page, add the page to a FixedDocument.
Well, now i've got a FixedDocument and going to print it via printDocument.
The Problem is, that the whole process of printing takes a lot of time and sometimes it doesn't work at all. It's like there is a preprocessing step to convert the fixed document into a bitmap.
My Question: Is a Visualbrush in a Canvas to big? Should i convert the Canvas first into a bitmap?
I've found this great article: http://www.codeproject.com/Articles/339416/Printing-large-WPF-UserControls.
Whatever.
Is it a good way to convert a huge canvas into a bitmap first and then print parts of the bitmap? I could very well imagine, that one could get problems with blurring effects this way.
I've got also no idea how to add a bitmap to a page in wpf.
The worst thing is, that i couldn't found some really good sorces or a standardway (and i think there has to be one, cause this should be a pretty standard problem) for printing dynamic produced canvas in wpf.
I am really greatful for every really good source, help or code.
Thank you for your time.
I need to print a panel(with many subpanel like tablepanellayout) in windows form.
I have seen many solutions such as draw as bitmap with capture screen - that give me correct form but my text and image is very blurred or draw by access all controls in that panels and draw by string or bitmap , it okays but I think it must have better solution.
Thx for read my problem and very thx for giving me a nice solution.
if you dont like the approach of bitmap image. what can be done is use of reportviewer and design the content you want to print. and Pass on the Data to the report viewer. there you can have the flexibity to print as well as export to other formats.
A Sample can be found in the following link to get started.
Click on this Link
I'm using Ribbon from RibbonControlsLibrary.dll 4.0.0.11019, .NET 4.0, C#, WPF.
It can be downloaded with a free samples here: http://www.microsoft.com/en-us/download/details.aspx?id=11877
The problem comes when a RibbonToggleButton is displayed. Then it's image seems to be a little bit broken, like a part of image is shifted for a few pixels.
EDIT: Thanks to kind people I can post and image now:
Here are some details:
Image is displayed in it's large variant
Image size is 32x32
I set image scaling to none for all the images of Ribbon
Image is broken only when the text in RibbonToggleButton has 1 line
Same image displays correctly in any other kind of button (RibbonButton, RibbonSplitButton etc.)
The image is displayed correctly when I set the font size in Windows to Medium (125%)
My OS is Windows 8
When I set the VerticalContentAlignment for the toggle button to "Bottom", the Image starts to display correctly, but the whole Ribbon starts to look ugly.
I experience this problem for all the toggle buttons, including those which are in a Microsoft's free samples.
I guess that probably the Image doesn't have enough space, so it's compressed from 32x32 to some smaller size.
I use the theme that is made of Microsoft's Generic theme, that is included in the RibbonControlsLibrary.dll. I guess I could fix the RibbonToggleButton template somehow, but I have no idea what to fix there.
Any ideas?
In the xaml declaration of your UserControl / Window put that line:
RenderOptions.BitmapScalingMode="HighQuality"
I just started to use Gtk# today, and I'm astonished how few Documentation and exampleprojects are out there. Anyways I wanted to ask, does anybody know how to add a backgroundimage to a window or a widget?
Or I don't know is it possible to stack multiple widgets over each other beacause, because then it would be quite easy.
Gtk.Window is for the GUI, for background images you need to use Graphics i.e you need to access the underlying GdkWindow . In Gtk# simply use
Gtk.Window mwin = new Gtk.Window();
Gdk.Window gwin = mwin.GdkWindow;
then use Gdk.Pixbuf to set the background image. Here's a link that may be helpful, it is in PHP-GTK, but it shouldn't be too hard to convert to C#.
http://www.kksou.com/php-gtk2/articles/place-a-background-image-in-GtkWindow.php