-2

我有一个问题,我正在制作自己的自定义 SharePoint webpart。一切顺利,但问题是我不知道如何更改文本框和标签的位置。有谁知道我如何更改位置?

我正在尝试在 C# 中完成它。

问题解决了。

4

2 回答 2

0

“如何更改文本框和标签的位置”

在此示例中,我使用了一个按钮(在单击按钮时执行的操作),并且我还添加了如何生成文本框和标签(当您按下此按钮时)。仅仅因为这通常是为控件设置位置的常见过程。

    private void button1_Click(object sender, EventArgs e)
    {
        // Settings to generate a New TextBox
        TextBox txt = new TextBox();   // Create the Variable for TextBox
        txt.Name = "MyTextBoxID";      // Identify your new TextBox

        // Create Variables to Define "X" and "Y" Locations
        var txtLocX = txt.Location.X;
        var txtLocY = txt.Location.Y;

        //Set your TextBox Location Here
        txtLocX = 103;
        txtLocY = 74;

        // This adds a new TextBox
        this.Controls.Add(txt);

        // Now do the same for Labels

        // Settings to generate a New Label
        Label lbl = new Label();   // Create the Variable for Label
        lbl.Name = "MyNewLabelID"; // Identify your new Label

        // Create Variables to Define "X" and "Y" Locations
        var lblLocX = lbl.Location.X;
        var lblLoxY = lbl.Location.Y;

        //Set your Label Location Here
        lblLocX = 34;
        lblLoxY = 77;

        // Adds a new Label
        this.Controls.Add(lbl);
    }
}

注意:这只是一个示例,回发后将不起作用。

我希望这能回答你和每个人的问题。

于 2013-11-01T16:39:41.077 回答
0

在组件 ID 的帮助下。设置该特定组件的位置。

于 2012-09-13T13:40:03.733 回答