如何在Windows窗体上显示文本? [英] How do you display text on a windows form?

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

问题描述

你好!我正在Visual Studio中创建一个生成语言的应用程序,然后在屏幕上显示它。我想使用Windows窗体,但无法使其工作。我尝试了Form1.Text = x,这给了我一个错误,但对按钮的文本属性
做同样的事情却没有。在此先感谢您的帮助!

Howdy! I'm making an app in Visual Studio which generates language, then displays it onscreen. I want to use a windows form, but can't get it to work. I tried Form1.Text = x, which gives me an error, but doing the same thing for a button's text property doesn't. Thanks in advance for any help!

使用System;

使用System.Collections.Generic;

使用System.ComponentModel;

使用System.Data;

使用System.Drawing;

使用System.Linq;

使用System.Text ;

使用System.Threading.Tasks;

使用System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

推荐答案

错误是什么行以及错误消息究竟是什么。

What line is the error on and what exactly is the error message.

如果这是错误行  Pomescreen.Text = test;然后将其更改为 

If this is the error line Pomescreen.Text = test; then change it to 

var form = new Pomescreen();

var form = new Pomescreen();

form.Text = test;

form.Text = test;

目前你可以这样做,所以你需要按如下方式移动它

Currently you can simply do that so you need to move it as follows

if (!formload)
{
    var form = new Pomescreen();
    form.Text = test;
    form.Show();
    
    formload = true;
}


这篇关于如何在Windows窗体上显示文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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