Integrate WinForms project into WPF

I've been working on a project for some time, and it requires alphablended non rectangular forms... which in a little research I found can be easily done in WPF. So I decided to port my project from WinForms to WPF. There are a few complications like a reference DLL based on WinForms I've been using doesn't work under WPF; it doesn't even show in the designer toolbox. I alrea

将WinForms项目集成到WPF中

我一直在研究一个项目一段时间,它需要alphablended非矩形形式......在我发现的一个小研究中,可以很容易地在WPF中完成。 所以我决定将我的项目从WinForms移植到WPF。 有一些并发症,如基于WinForms的引用DLL,我一直使用在WPF下不起作用; 它甚至不会在设计器工具箱中显示。 我已经尝试通过右键单击并选择选择项目将其加载到工具箱中,但它不会在那里显示。 我从来没有在WPF工作过,但它看起来对我的要求很有希望。 那么

How to properly exit a C# application?

I have a published application in C#. The problem here is whenever I close the main form by clicking on the red exit button, it closes the form but it doesn't close the application. I found this out when I tried shutting down the computer, hopeful that the application I made was running smoothly then I was bombarded by a lot of child windows with which I have put MessageBox Alerts. I trie

如何正确地退出C#应用程序?

我在C#中发布了一个应用程序。 这里的问题是每当我点击红色退出按钮关闭主窗体时,它会关闭窗体,但不会关闭应用程序。 当我尝试关闭计算机时,我发现了这一点,希望我所做的应用程序能够顺利运行,然后我被很多子窗口轰炸,并且我已经放置了MessageBox警报。 我尝试了Application.Exit,但它仍然调用了所有的子窗口和警报,我不知道如何使用Environment.Exit和放入它的整数。 顺便说一句,无论我的表单何时调用formclosed

WPF or Windows Forms

I've been playing around with C# console applications for about a year and I want to move on to creating GUI applications. I have never done any GUI development besides basic Java applications, but I want to continue using C#. Should I start learning Windows Forms or jump straight to WPF? Is there a huge difference? Does WPF build on top of Windows Forms or are they totally different? I

WPF或Windows窗体

我一直在玩C#控制台应用程序大约一年,我想继续创建GUI应用程序。 除了基本的Java应用程序之外,我从未做过任何GUI开发,但是我想继续使用C#。 我应该开始学习Windows Forms还是直接跳到WPF? 有很大的区别吗? WPF是建立在Windows窗体之上还是完全不同? 如果你刚开始,直接跳到WPF。 它将允许您开始使用标记来制作丰富的界面来定义您的界面,而不会告诉您可能从Windows Forms学习的不良习惯(对于WPF)。 这两个是

What are the bigger hurdles to overcome migrating from Winforms to WPF?

I've been developing Winforms applications in C# for a few years now and have been interested in moving future development toward WPF, mainly because of the positive things I've been hearing about it. But, I'm wondering what sort of hurdles others have had to overcome as they migrated to WPF. Was there a significant hit to your productivity or any particular issues which you found c

克服从WinForms迁移到WPF有什么更大的障碍?

我已经使用C#开发Winforms应用程序几年了,并且一直对将来的WPF发展感兴趣,主要是因为我听到了有关它的积极的事情。 但是,我想知道在他们迁移到WPF时,其他人需要克服哪些障碍。 是否对您的生产力或任何您发现具有挑战性的特定问题产生重大影响? 我不确定我能给你一个障碍,因为它完全偏离了WinForms。 我的建议是获得Adam Nathan的WPF Unleashed,忘记了关于使用任何以前的技术构建UI的所有知识(Winforms,MFC,Java

WPF FlowDocument will not fill Viewbox container

I have a WPF usercontrol that I want to load with dynamic content in code using a FlowDocument: textblocks, bulleted lists, etc. Content is loaded as expected. And the box sizes looks fine in designer, but in runtime the FlowDocument insists on clipping the result and only show part of the width. My assumption was that the Viewbox would fill the grid cell and the inner FlowDocument to fill up

WPF FlowDocument不会填充Viewbox容器

我有一个WPF用户控件,我想在代码中使用FlowDocument加载动态内容:文本块,项目符号列表等。内容按预期加载。 在设计器中框的大小看起来不错,但是在运行时,FlowDocument坚持剪裁结果并仅显示部分宽度。 我的假设是,Viewbox将填充网格单元格和内部FlowDocument以填充所有可用空间。 我试图在代码中设置FlowDocument的PageWidth / PageHeigth,但没有结果。 任何帮助赞赏。 <Grid x:Name="grdDisplay"> <G

Printing a flowdocument with dynamic data in WPF

I am trying to find a good way to print a flow document in WPF. What I want is to have a possibility to see how the document turns out as I design it, so therefore creating a pure FlowDocument as a XAML is out of the questions (as Visual Studio wont show the design view for it). So what I have done now is to create a window that contains a FlowDocument like this (some excessive parts have been

使用WPF中的动态数据打印流文档

我正试图找到一种在WPF中打印流文档的好方法。 我想要的是有可能看到文档如何设计,因此创建一个纯粹的FlowDocument作为XAML是不存在的(因为Visual Studio不会显示它的设计视图)。 所以我现在所做的就是创建一个包含这样的FlowDocument的窗口(为了使代码更加简洁,已经删除了一些过多的部分): <Window x:Class="MyNamespace.ProjectPrintout...> <Grid> <FlowDocumentReader> <FlowDoc

Multipage FlowDocument in WPF

A beginner in WPF Documents here. I am exploring the possibility to display page by page static content in WPF application. Much like a PowerPoint presentation in which slides can be navigated next and previous. From my initial research I thought FlowDocument is what I was looking for but I stuck in it while I needed to show multiple pages which can be navigated next and previous. Anyone c

WPF中的多页面FlowDocument

这里是WPF文档的初学者。 我正在探索在WPF应用程序中逐页显示静态内容的可能性。 就像PowerPoint幻灯片一样,幻灯片可以在其中和之前导航。 从我最初的研究中,我认为FlowDocument是我一直在寻找的东西,但我坚持在它,而我需要显示多个可以导航下一个和以前的页面。 任何人都可以请指导我,如果我正在使用FlowDocument正确的方式,我如何可以有多个页面(或文档)? 以下是我为单个页面工作的内容: <FlowDocumentR

only property even with OneWay mode set

ViewModel namespace My.ViewModels { public class ItemViewModel : ObservableObject { private ItemModel _model; public ItemViewModel(ItemModel model) { _model = model; } public string Name { get { return _model.Name; } } } } XAML <UserControl x:Class="My.Controls.ItemControl" xmlns="http://schemas.microsoft.com/win

即使使用单向模式设置也只有财产

视图模型 namespace My.ViewModels { public class ItemViewModel : ObservableObject { private ItemModel _model; public ItemViewModel(ItemModel model) { _model = model; } public string Name { get { return _model.Name; } } } } XAML <UserControl x:Class="My.Controls.ItemControl" xmlns="http://schemas.microsoft.com/winf

calling .NET COM object from VBScript

I use VS 2008 and Windows 7. Got a .NET C# class which is exposed as COM object. [Guid("E5014B85-FCB2-4F0D-95EC-F741395A7923")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DSystem { [DispId(1610809354)] void setProperties(IDictionary propertymap); } COM object is called from a VBScript dim dSystem set dSystem = CreateObject("MYCOMOBJECT") Dim objDictionary

从VBScript调用.NET COM对象

我使用VS 2008和Windows 7。 有一个.NET C#类,它是作为COM对象公开的。 [Guid("E5014B85-FCB2-4F0D-95EC-F741395A7923")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DSystem { [DispId(1610809354)] void setProperties(IDictionary propertymap); } COM对象从VBScript中调用 dim dSystem set dSystem = CreateObject("MYCOMOBJECT") Dim objDictionary Set objDictionary = Creat

C# HttpListener 'Bad request' problem

For some reason when request is sent to HttpListener via non-standart address it returns <h1>Bad Request (Invalid Hostname)</h1> Example packet: GET /index HTTP/1.1 Host: ::ffff:88.118.32.126:2548 Accept: */* HTTP/1.1 400 Bad Request Content-Type: text/html Server: Microsoft-HTTPAPI/1.0 Date: Wed, 02 Feb 2011 19:05:18 GMT Connection: close Content-Length: 39 <h1>Bad Request

C#HttpListener'坏请求'问题

由于某种原因,当请求通过非标准地址发送给HttpListener时,它会返回 <h1>Bad Request (Invalid Hostname)</h1> 示例包: GET /index HTTP/1.1 Host: ::ffff:88.118.32.126:2548 Accept: */* HTTP/1.1 400 Bad Request Content-Type: text/html Server: Microsoft-HTTPAPI/1.0 Date: Wed, 02 Feb 2011 19:05:18 GMT Connection: close Content-Length: 39 <h1>Bad Request (Invalid Hostname)</h1>