如何制作标签和标签Windows Mobile 上的其他控件透明且带有背景图像?

发布于 2024-09-25 05:23:44 字数 476 浏览 4 评论 0原文

我正在用 C# 开发智能设备应用程序。我是 Windows Mobile 新手。我已使用以下代码将背景图像添加到应用程序中的表单中。我想做标签&该窗体上的其他控件透明,以便我的 Windows 窗体能够正确显示。

protected override void OnPaint(PaintEventArgs e)
                {
                    base.OnPaint(e);
                    Bitmap CreateCustomerImage = new Bitmap(@"/Storage Card/background.png");
                    e.Graphics.DrawImage(CreateCustomerImage, 0, 0);
                }

怎么办?如何解决这个问题呢?您能给我提供任何可以解决上述问题的代码或链接吗?

I am developing the smart device application in C#. I am new to the windows mobile. I have added the background image to the form in my application by using the following code. I want to make label & other controls on this form transparent so that my windows form will be displayed properly.

protected override void OnPaint(PaintEventArgs e)
                {
                    base.OnPaint(e);
                    Bitmap CreateCustomerImage = new Bitmap(@"/Storage Card/background.png");
                    e.Graphics.DrawImage(CreateCustomerImage, 0, 0);
                }

how to do this ? How to solve this problem? Can you provide me any code or link through which I can solve the above issue?

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

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

发布评论

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

评论(1

秋意浓 2024-10-02 05:23:44

Windows CE 本质上并不支持透明控件,这往往是一个巨大的痛苦。您必须使用 ColorKey 透明度之类的东西,因此在 OnPaint 中,您需要用一种颜色填充背景(洋红色是一种流行的颜色),并使用 SetColorKey 使该颜色透明。

网上有一些关于色键透明度的教程。 这是我刚刚在搜索引擎中找到的一个,看起来很合理,但也可以随意搜索其他引擎。

当您在容器控件中拥有控件(然后该控件位于窗体上)时,就会发生这种情况。为了使其正常工作,您必须从表单一直向下级联调用剪切区域。我没有现成的示例,该示例不在运输项目内,因此我无法轻松发布它。不过,如果您遇到这种情况,请更新问题,我会看看是否可以提取一些内容。

Windows CE doesn't inherently support transparent controls, which tends to be a huge pain. You have to use something like ColorKey transparency, so in your OnPaint, you need to fill the background with a color (magenta is a popular one) and use SetColorKey to make that color transparent.

There are several tutorials online for colorkey transparency. Here is one that I just found with a search engine that looks reasonable but feel free to search for others as well.

The place this falls down is when you have controls in a container control, which is then on the Form. To get that to work right you have to cascade calls to clipping regions from the Form all the way down. I don't have a ready sample of this that isn't inside a shipping project, so I can't easily post it. If you run into this, though, update the question and I'll see if I can extract something.

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