Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Windows应用程序_C# - Fatal编程技术网

C#Windows应用程序

C#Windows应用程序,c#,C#,如何在C#windows应用程序中添加列使用例如,它有一个属性。。。可以添加具有ListViewItems属性的列。不过,还有其他获取列的可能性(控件)(如) 也许你应该看看这个组件。任何一本像样的书都会涵盖它们。公共类column:Control public class Coloumn : Control { } //in your Form Load for(int i=0;i<100;i++) this.Controls.Add(new Coloumn()); //whe

如何在C#windows应用程序中添加列使用例如,它有一个属性。。。可以添加具有ListViewItems属性的列。不过,还有其他获取列的可能性(控件)(如)

也许你应该看看这个组件。任何一本像样的书都会涵盖它们。

公共类column:Control
public class Coloumn : Control
{
}

//in your Form Load
for(int i=0;i<100;i++)
    this.Controls.Add(new Coloumn());
//when the control comes here, your form is flooded with Coloumns..
{ } //以你的形式加载 对于(int i=0;i,如下所示:

using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Net;

namespace WithColumns
{
    public class FormWithColumns : Form
    {
        public FormWithColumns()
        {
            Label label1 = new Label();
                Label label2 = new Label();

            SuspendLayout();


            WebRequest req = WebRequest.Create("http://www.bc.edu/bc_org/avp/cas/fnart/arch/greek/doric1.jpg");
            WebResponse response = req.GetResponse();
            Stream stream = response.GetResponseStream();
            Image img = Image.FromStream(stream);

            stream.Close();

            ClientSize = new Size(img.Width * 3, img.Height);

            label1.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
            label1.Location = new System.Drawing.Point(0, 0);
            label1.Size = img.Size;
            label1.Image = img;

            label2.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            label2.Location = new System.Drawing.Point(img.Width * 2, 0);
            label2.Size = img.Size;
            label2.Image = img;

            Controls.Add(label1);
            Controls.Add(label2);
            Text = "Form With Columns";
            BackColor = Color.White;
            ResumeLayout(false);
        }
    }
}

向什么添加列?DataGridView、ListView、etcHi和welcome to Stack Overflow,但我担心在任何人对这个问题给出任何有意义的答案之前,您必须发布更多信息。单击添加列根据您的说法,什么是列或您想要什么类型的列?它在您的应用程序中应该起什么作用?例如e添加C#web应用程序的方式!!请看我需要datagridview列也许您应该在问题中指定它。@Lawrance问另一个问题,这个问题非常清楚地说明您是否在使用WinForms(您的另一个问题是关于ajax的),您想在其中添加一个列,以及您谈论的是设计时还是运行时。如果您问了一个愚蠢的问题,您只会得到愚蠢的答案。很好,很感谢您的服从