如何在mac OS中编写Windows窗体应用程序? [英] How to program windows forms applications in mac OS?

查看:3021
本文介绍了如何在mac OS中编写Windows窗体应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello everbody,



是否可以选择visual studio,这样可以在Visual Studio中编写程序作为Mac OS?我想编写代码来制作Windows窗体应用程序!



我知道我可以创建一个虚拟机并运行Windows 7或更高版本操作它然后运行一个VS工作,我正在寻找一个独立的程序。



Xamarin Studio可以提供帮助吗?



问候< br $>
AM



我尝试过:



我曾尝试使用Xamarin,但它似乎没有足够的选项作为Visual studio!

解决方案

你可以这样做,如果你安装Mono,替代品CLR实现,在Mac OS X上: Mono(软件) - 维基百科,免费的百科全书 [ ^ ]。



Mono支持.NET BCL和部分非标准.NET FCL,它包括 System.Windows.Forms 。然后,您可以在Windows或MAC上开发应用程序。在Windows上,您可以使用.NET或Mono,Visual Studio或SharpDevelop或MonoDevelop IDE。在Mac上,您可以使用MonoDevelop。在所有情况下,您都可以使用相同的程序集用于.NET,Mono for Windows或Mono for Mac,而无需重新编译。然而,你将面临一些不兼容性。



在Windows上进行开发的一个不错的方法是开发和测试.NET上的所有东西,然后测试它的Mono for Windows,并且,在不兼容的情况下,修复它们并再次测试Mono。这样,您就可以在Windows上进行必要的内部开发周期。如果某些代码在Mono for Windows上运行良好,Mono对其他平台的其他问题则不太可能。



另请参阅:

< a href =https://en.wikipedia.org/wiki/SharpDevelop> SharpDevelop - 维基百科,免费的百科全书 [ ^ ],

SharpDevelop @ ic#code [ ^ ],

MonoDevelop - 维基百科,免费的百科全书 [ ^ ],

MonoDevelop | MonoDevelop [ ^ ]。



现在,更多的问题:Mono对许多平台都有好处,但苹果平台对外国人是众所周知的敌意。即使您成功开发正确运行的Windows窗体应用程序,它在Mac上看起来也很陌生;特别是,您将看到桌面顶部的标准Mac菜单始终显示,但与您的应用程序无关,可能有自己的主菜单,如普通Windows窗体应用程序。



您是否可以开发Mono应用程序以在Mac上本机运行。是的,但它们与Windows不兼容。要开发这样的原生界面,您可以使用另一种产品,Monobjc:

Monobjc - 维基百科,免费的百科全书 [ ^ ],

Monobjc [ ^ ]。



对于Windows开发人员来说,这种使用方法要复杂得多;你应该更好地了解本机Mac开发至少一点;最好理解Objective-C,至少是基本的想法: Objective-C - 维基百科,免费的百科全书 [ ^ ]。



这可能超出了你的问题,但我想提到另一种非常奇特的可能性:我在Mac上尝试了Mono开发并尝试了以下不寻常的应用程序架构:我设法创建了两个独立的UI线程,一个运行 System.Windows.Forms.Application ,另一个运行Mac OS X API应用程序。粗略地说,一个运行主 System.Windows.Forms.Form ,另一个运行Mac主菜单,一些跨线程代码提供两者之间的协作。 br $> b $ b

-SA


嗯......你真正需要的只是一个文本编辑器和一个C#编译器...但是这很辛苦!

有一个版本的VS本机适用于Mac: Visual Studio代码 [ ^ ] - 但AFAIK只支持ASP和云应用程序,而不支持WinForms。

与PC或Windows相比,我真的不确定它是个好主意。在虚拟机中,只是因为你需要其中一个或另一个来测试代码,无论如何你都要写它!至于调试......你还是非常希望VS能够运行。 :笑:

我?我坚持使用PC(它们与Mac相比并不昂贵)和VS社区版(许可证许可证)的副本或者使用VM路由 - 它将更简单,更容易调试。

Hello everbody,

Is there any alternative to visual studio, that makes it possible to write program in visual studio as Mac OS ? I would like to write codes to make windows forms applications!

I know that I can make a VM and run a windows 7 or higher opn it and then run a VS to work, I am looking for a standalone program.

Can Xamarin Studio help?

regards
AM

What I have tried:

I have tried to work with Xamarin, but it seems it has not enough options as Visual studio!

解决方案

You can do it if you install Mono, the alternative CLR implementation, on Mac OS X: Mono (software) — Wikipedia, the free encyclopedia[^].

Mono supports .NET BCL and part of non-standard .NET FCL, and it includes System.Windows.Forms. Then you can develop the applications on either Windows, or MAC. On Windows, you can use .NET or Mono, Visual Studio, or SharpDevelop, or MonoDevelop IDE. On Mac, you can use MonoDevelop. In all cases you can use the same assemblies for .NET, Mono for Windows, or Mono for Mac, without recompilation. However, you will face some incompatibilities.

One nice way to do development on Windows would be developing and testing everything on .NET and then testing it for Mono for Windows, and, in case of incompatibilities, fix them and test on Mono again. This way, you can do essential inner development cycle on Windows only. If some code works well on Mono for Windows, additional problems with Mono for other platforms are much less likely.

See also:
SharpDevelop — Wikipedia, the free encyclopedia[^],
SharpDevelop @ic#code[^],
MonoDevelop — Wikipedia, the free encyclopedia[^],
MonoDevelop | MonoDevelop[^].

Now, more problems: Mono is good for many platforms, but Apple platforms is notoriously hostile to the "foreigners". Even when you successfully develop correctly working Windows Forms application, it will look foreign on Mac; in particular, you will see that the standard Mac menu on top of the desktop is shown as always, but is unrelated to your application, which may have it's own main menu, like in "normal" Windows Forms applications.

Can you develop Mono applications to behave natively on Mac. Yes, but they won't be compatible with Windows. To develop such native interface, you can use another product, Monobjc:
Monobjc — Wikipedia, the free encyclopedia[^],
Monobjc[^].

It's usage is much trickier for a Windows developer; you should better understand native Mac development at least a little; and it would be good to understand Objective-C, at least the basic ideas: Objective-C — Wikipedia, the free encyclopedia[^].

This may be beyond your question, but I want to mentioned another, pretty exotic possibility: I experimented with Mono development on Mac and tried out the following unusual application architecture: I managed to create two separate UI threads, one running System.Windows.Forms.Application, and another one Mac OS X API application. Roughly speaking, one operates main System.Windows.Forms.Form, and another one the main Mac-style menu, and some cross-thread code provides collaboration between the two.

—SA


Well...all you really need is a text editor and a C# compiler...but it's hard work!
There is a version of VS that works on Macs natively: Visual Studio Code[^] - but AFAIK that only supports ASP and Cloud apps, not WinForms.
I'm really not sure it's a good idea, compared with the PC or Windows-in-a-VM, simply because you are going to need one or the other of those to test you code as your write it anyway! And as for debugging...you pretty much want VS running anyway. :laugh:
Me? I'd stick with a PC (they aren't expensive compared to a Mac) and a copy of VS Community edition (licence permitting) or go the VM route - it'll be a lot simpler and easier to debug.


这篇关于如何在mac OS中编写Windows窗体应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆