简体   繁体   English

Mono 上的 C# 用户控制?

[英]C# User Control on Mono?

I'm porting a Windows Form C# application in Linux using mono.我正在使用 mono 在 Linux 中移植 Windows Form C# 应用程序。 I'm solving a lot of problems but now I don't know what I need to do.我正在解决很多问题,但现在我不知道我需要做什么。

I can't use the User Control on linux.我无法在 linux 上使用用户控件。

I have used many user controls as container with some control (each User Control is a button bar with some big button) that I display when I need.我使用了许多用户控件作为带有一些控件的容器(每个用户控件是一个带有一些大按钮的按钮栏),我会在需要时显示这些控件。

When I execute the application on linux, it does not work.当我在 linux 上执行应用程序时,它不起作用。

All of my User Controls (container) become transparent.我所有的用户控件(容器)都变得透明。 If I move the mouse I see that there is a button because the mouse cursor changes and the button responds to clicks, but it is transparent.如果我移动鼠标,我会看到有一个按钮,因为鼠标光标发生变化并且按钮响应点击,但它是透明的。

The problem was not in the User Controls but in their function paint override.问题不在于用户控件,而在于它们的功能绘制覆盖。 I created an override that did set some parameters of the control (size of text, syle of text) and then drew the base paint我创建了一个覆盖,它确实设置了控件的一些参数(文本大小、文本样式),然后绘制了基础涂料

public override paint(...) {
    //...instruction...
    base.paint(...);
}

This created problems.这就产生了问题。 Now I removed all instruction and it works.现在我删除了所有指令并且它有效。 For me this is enough.对我来说这已经足够了。 Any changes to the control do otherwise.对控件的任何更改都会执行其他操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM