winforms-interop

How to avoid visual artifacts when hosting WPF user controls within a WinForms MDI app?

When hosting WPF user controls within a WinForms MDI app there is a drawing issue when you have multiple forms that overlap each other that causes very distinct visual artifacts. These artifacts are mostly visible after dragging one child form over another one that also hosts WPF content or by allowing the edges of the child form to be c...

WinAPI magic and MONO runtime

I'm trying to get the same result of a .NET application (see the link Hide TabControl buttons to manage stacked Panel controls for details), but using the MONO runtime instead of the MS .NET runtime. Pratically, when the custom control is executed using the MONO runtime, the underlying message is not sent to the control, causing the tab...

How do WinForms controls inside WPF WindowsFormsHost remote?

Say, I have a WPF program with a Windows Forms control in "WindowsFormsHost" on some of its windows. I use that program via Remote Desktop. How will this control's graphics remote? Via GDI instructions as if it was WinForms app or as plain bitmaps like WPF does? ...

How to get default Ctrl+Tab functionality in WinForms MDI app when hosting WPF UserControls

I have a WinForms based app with traditional MDI implementation within it except that I'm hosting WPF based UserControls via the ElementHost control as the main content for each of my MDI children. This is the solution recommended by Microsoft for achieving MDI with WPF although there are various side effects unfortunately. One of which ...

Problem dragging Winforms TreeNode to WPF List

I'm having some problems dragging a WinForms TreeNode to a WPF ListBox. I set the ListBox.AllowDrop = true and subscribe the DragEnter and Drop events. The events are raised when they should but I think the Args are a bit messed up. I'm trying to filter the objects that can be dropped into this specific target. I just started by trying...

Active Reports winforms viewer control hosted in WPF Window

There is currently not an available WPF viewer for Active Reports 6. I was attempting to use a host control to display the viewer in a interop host but I'm not having much luck. Has anyone else attempted this successfully? I can't even get the wrapper Viewer control to add to the project toolbox as a custom control at this point. I'...

What's the best way to handle the same shortcut in WPF and WinForms controls?

I have a WPF application with the following KeyBinding on its main window: <KeyBinding Command="Commands:EditCommands.Undo" Gesture="CTRL+Z" /> <KeyBinding Command="Commands:EditCommands.Redo" Gesture="CTRL+Y" /> This makes the command respond to the shortcut fine. However, in all the places where I have embedded WinForms text boxes o...

Interop Forms Toolkit DLL and "Class does not support Automation or does not support expected interface" error

I have a .NET WinForms application that I've converted into a COM dll using the Interop Forms Toolkit 2.1. Thet setup project for the application has both my tlb as well as the Microsoft.InteropFormTools.tlb file set to Register as vsdrpCOM. The prerequisites for the project are to ensure that Windows Installer 3.1, .NET Framework 3.5 SP...

How to add a WPF window to a WinForms App

I'm creating a HUD window for inspecting biz entities in my WinForms application. I wanted to have a completely different style of window (minimize the content area and showing only the TitleBar, no system buttons, etc) so I created a WPF application for this. The problem is that I want this Window to 'live' inside my WinForms applic...

No touch deployment + ElementHost

We have a WinForms application that is executed through no touch deployment. We're hosting a WPF control that has a simple ListView control with GridView. Every time we try to launch it through the no touch, we experience a ver long rendering time. However, when it's executed directly off the dev machine, it renders very quickly. Are th...

Get a Handle IntPtr from a DataGridViewTextBoxCell?

I have a DataGridView with a column of text box cells that need to have watermark text. I also have a static class that uses DLLImport to add a watermark to a TextBox using SendMessage with a IntPtr hWnd as one of parameters, like this: public static void SetWatermark(TextBox textBox, string watermarkText) { SendMessage(text...

WindowsFormsHost not showing when Wpf Window style is set

I have a WPF Window that has a WinForms Button inside. When I set the Style of the Window the button isn't rendered, but when the Window Style is not set the Button appears as it should be. Window Xaml: <Window x:Class="Telbit.TeStudio.View.Forms.FloatingTestComponentsBrowser" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/pre...

WPF Control embedded in Winform causes App Crash

I am working on an outlook addin where we are using WPF user control embedded in a Windows form using ElementHost. This app crashes on only few machines intermittently.After analyzing crash dump,the WPF rendering thread seems to be causing this crash.The stack trace in the windbg looks like FAULTING_IP: msvcr80!memcpy+5a 7814500a...

How can I make a WinForms Form work as a DockableContent in AvalonDock?

I am able to use WinForms controls, but not an entire form: var foo = new DockableContent(); foo.Title = "Foo"; foo.Name = "FooName"; var c = new WindowsAppFramework.RenderTargetUserControl(); c.Dock = System.Windows.Forms.DockStyle.Fill; c.AutomaticUpdateFPS = 60; var host = ne...

WPF/WinForms/GDI interop: converting a WriteableBitmap to a System.Drawing.Image?

How can I convert a WPF WriteableBitmap object to a System.Drawing.Image? My WPF client app sends bitmap data to a web service, and the web service needs to construct a System.Drawing.Image on that end. I know I can get the data of a WriteableBitmap, send the info over to the web service: // WPF side: WriteableBitmap bitmap = ...; in...

Show Form with PInvoke

Hi, I have below scenario: WinForms app which allow only one instance of this app to be run (Mutex is in use here to check). App on start with some paramatere is runnig but hidden. When somebody will click on app again then Mutex will detect that app is already running and "unhide" the main form by call of native method (see method Brin...

Can I Call unmanaged Mobile CE Dll from Full .Net Framework (Run on Desktop)

I have an Unmanaged Lib compiled for Windows Ce. I am trying to call this dll from VB.net Full Framework .Net 4 Client Profile Windows application. I am trying to use the same code that I use in the Compact Framework application. It compiles without errors and runs but when Invoking a function I get error ex = {"An attempt was made to lo...

.net Winform with Modal window when Minimized using user32dll.ShowWindow() loses its open modal windows on opening!!

we have a weird requirement where our apps executed in the Sandbox environment are manipulated by some other app. The outer app modifies the visual style of the windows using ShowWindow() of the user32 dll. When a .net app with MODAL windows opened is Minimized and maximized by the Outer app, it loses all the modal windows which were op...

WPF Menu on Winforms

Is it possible to show WPF Context menu on WinForms? If yes, how could we do that? ...

WinForms to WPF - How do we get there from here?

Is there a practical way for us to slowly evolve a WinForms application to WPF without creating a support nightmare for ourselves with strange interop scenarios? Background info: We have a large battleship gray WinForms application that is heavily used by an internal group of about 60-75 users. We're starting to run into places where ...