如何在 WinForms 中创建自定义 3D 轮播控件?

发布于 2024-10-16 09:52:08 字数 356 浏览 2 评论 0原文

我有一个 winforms 项目,我想为其开发自定义控件。

我的计划是完全“手工”绘制控件。

它将是一个 3D 轮播,但不像我发现的使用图标和 OpenGL 或其他库将视觉效果渲染到图标上的示例。我将在轮播中绘制每个对象,并在运行时以数学方式渲染这些对象的视觉效果(光照、倾斜等)。

我知道有图书馆可以帮助解决此类问题(但在做出选择时没有足够的经验可供借鉴),因此我正在寻求实现此目标的建议。

请提出建议,使我能够编译和交付我的应用程序,而不会因“第 3 方”依赖项而造成较大的尺寸损失(即我只想发送所需的 dll - 互操作或其他)。

另请注意,我正在寻找一个免费的金钱(0 美元)库,因为这是一个个人项目(目前)。

I have a winforms project that I want to develop a custom control for.

My plan is to draw the control completely "by hand".

It will be a 3d carousel, but not like the examples I have found that use icons and OpenGL or some other library to render visual effects onto icons. I will be drawing each object in the carousel and rendering visual effects (lighting, skew, etc) for those objects mathematically during runtime.

Knowing that there are libraries to help with this sort of thing (but not having sufficient experience to draw from in making a choice), I am seeking suggestions for accomplishing this.

Please make suggestions that will allow me to compile and deliver my application without imposing a large size penalty for the "3rd party" dependency (i.e. I would like to ship only the required dlls - interop or otherwise).

Also note that I am looking for a free as in money ($0) library as this is a personal project (for now).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虫児飞 2024-10-23 09:52:09

我暂时同意科迪·格雷的建议。

我可能会决定稍后选择另一个方向,但到目前为止,这似乎是最简单的路径。

顺便说一句,我在使 WPF 控件与 WinForms 主机应用程序一起使用时遇到问题的原因如下所述:

http://windowsclient.net/learn/integration.aspx

最重要的是:

此外,您将需要修改项目文件,因为 Windows 应用程序不处理 XAML 文件。您将需要打开项目文件(.csproj、.vbproj、等)在记事本等编辑器中,然后滚动到底部。您将看到以下行:

<导入项目=“$(MSBuildBinPath)\Microsoft.CSharp.targets”/>

您需要复制此行并将其粘贴到上一行的正下方,然后将“CSharp”更改为“WinFX”,以使这两行看起来像:

<导入项目=“$(MSBuildBinPath)\Microsoft.CSharp.targets”/>

<导入项目=“$(MSBuildBinPath)\Microsoft.WinFx.targets”/>

现在保存此文件并使用 VS 重新加载项目并运行应用程序。

似乎我要么忽略了这个重要的细节,要么我所剖析的例子未能强调这一点。

无论哪种方式,我希望这可以帮助将来尝试做类似事情的其他人!

HTH,

E

I am going to go with the suggestion by Cody Gray for the moment.

I may decide to go another direction at a later date, but so far this seems to be the simplest path.

BTW, the reason that I have had trouble getting a WPF control to work with a WinForms host application is discussed here:

http://windowsclient.net/learn/integration.aspx

Most importantly:

In addition, you will need to modify the project file because the Windows Application does not what to do with the XAML file. You will need to open the project file (.csproj, .vbproj, etc.) in an editor like Notepad and then scroll to the bottom. You will see the following line:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

You will need to copy this line and paste it just below the above line and then change "CSharp" to "WinFX" so that the two lines look like:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

<Import Project="$(MSBuildBinPath)\Microsoft.WinFx.targets" />

Now save this file and reload the project using VS and run the application.

Seems as if I have either been overlooking this important detail, or the examples which I have been dissecting have failed to emphasize this point.

Either way, I hope that this may help others in the future who may be attempting to do something similar!

HTH,

E

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文