winforms-interop

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

荒凉一梦 提交于 2019-12-30 01:27:05
问题 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 clipped by the main MDI parent when dragging it around. After the drag and drop of the child form is completed the artifacts stay around generally but I've

Changing host WinForm properties from ViewModel bound to ElementHost

跟風遠走 提交于 2019-12-25 01:23:49
问题 Can anyone suggest approaches that will allow me to change the properties of a host WinForm from a WPF element in an ElementHost? I have an MVVM application using Prism that's bound to an ElementHost. I would like to change the WinForm title, resize the WinForm and close the WinForm from within my ViewModel. I understand receiving data from a WPF composite control described in this article but I can't see how that will work in a ViewModel. App is the WinForm ChartWizardViewModel is the

Mouse events are not received by a WPF ScrollViewer when hosted in a WinForms container

自闭症网瘾萝莉.ら 提交于 2019-12-23 09:35:29
问题 We have a WinForms application that we are progressively converting to WPF. At this point the application's main form is a Form (WinForms) that contains a vertical sidebar built in WPF. The sidebar is hosted in an ElementHost control. The sidebar is made of a ScrollViewer that contains other controls. The problem is that when the focus is somewhere in the WinForms aera and I use the mouse wheel over the ScrollViewer, it does not scroll. This is related to the WPF/WinForms integration because

Windows Forms WebBrowser control error on .net 4.0 framework

只愿长相守 提交于 2019-12-23 05:38:06
问题 I have a fatal error thrown from my c# code where I have customized forms web browser to support browser autocomplete functionality. The exception gets thrown only on .net 4.0 framework, when we try to obtain the WebBrowserSite COM interfaces. error thrown at _baseIDocHostUiHandler = (WebBrowserNativeMethods.IDocHostUIHandler) Marshal.GetTypedObjectForIUnknown(_unkInnerAggregated, typeof (WebBrowserNativeMethods.IDocHostUIHandler)); Code: // constructor public AutoCompleteWebBrowserSite

Why won't the Excel process close while app is running

心已入冬 提交于 2019-12-23 04:52:28
问题 Question: Why won't the Excel process close while app is running? Please don't jump the gun and mark it duplicate. If you could show the change needed in the code I really appreciate it. Excel process closes nicely when I close the app . I researched this problem for last few day read several SO posts and tried several things but nothing is working except for calling process.kill which I prefer to avoid if possible. Imports Microsoft.Office.Interop Imports System.Runtime.InteropServices

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

不想你离开。 提交于 2019-12-23 02:47:54
问题 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 is that my Ctrl+Tab functionality for tab switching between each MDI child is gone because the tab key seems to be swallowed up by the WPF controls. Is there

Application hanging during CoCreateInstance of .NET-based COM object

痞子三分冷 提交于 2019-12-21 20:09:46
问题 I have a C++ DLL that is creating an instance of a COM object that's implemented in .NET. Under many circumstances this works fine, but under certain circumstances, it hangs the application, and I see it stuck with the following call stack (this is just the part underneath the level of my DLL's code): ntdll.dll!_NtAlpcSendWaitReceivePort@32() rpcrt4.dll!LRPC_CASSOCIATION::AlpcSendWaitReceivePort(unsigned long,struct _PORT_MESSAGE *,struct _ALPC_MESSAGE_ATTRIBUTES *,struct _PORT_MESSAGE *

Unable to load DLL “OraOps10.dll”

走远了吗. 提交于 2019-12-21 01:21:13
问题 I am running into peculiar issue. I am developing a windows based application which connects to Oracle database. For initial testings, I have created installer and tested on different machines that I have. Each machine has Oracle Client installed and I did not see any problem in running application. But when I share this installer with customer, he is getting error "Unable to load DLL OraOps10.dll". When asked he mentioned and has shown the Oracle Client installed on his machine and he is

how to play flash in WPF application

a 夏天 提交于 2019-12-20 04:52:53
问题 I have a WPF application and I want to play flash movies in it. I used the WInforms active X control as described in this link It worked partially, but now whenever I run the application it crashes saying "InvalidActiveXStateException" does anyone have an idea how to solve this? 回答1: I would recommend adding a WebBrowser control to your WPF application and allow IE to load the URL of the Flash Movie directly; which in turn would load the Flash Plugin. You will need to build your WPF

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

浪子不回头ぞ 提交于 2019-12-20 03:44:09
问题 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 = ...; int width = bitmap.PixelWidth; int height = bitmap.PixelHeight; int[] pixels = bitmap.Pixels; myWebService.CreateBitmap(width, height, pixels); But on the web