事件处理和放大器;可见放大器、事件

2023-09-03 06:19:47 作者:鱼爱海的蓝却不知天的湛

好吧,我正在为我班的一个项目。我必须让一切在一个页面上,对顶部的菜单。在菜单中它是假设有新的,开放的,从HTML,保存并退出。我所有,但由HTML语言入门之一完成。我有点糊涂了。同是在一个页面上,当用户单击该从HTML显示它显示一个文本框和一个按钮,那么你应该能够把一个网址,然后点击去和HTML code显示在RichTextBox中所需的一切。现在我遇到的问题是得到了所有单词的权利。这是我迄今为止..

Ok I am working on a project for my class. I have to make everything on one page, have a menu on the top. In the menu it is suppose to have new,open,From Html,save,and exit. I have all but the From HTML one done. I am kinda confused. with everything needed to be on one page when the user click the From HTML it show show a textbox and a button then you should be able to put in a web address and click go and the html code shows up in the richtextbox. Now the problem I am having is getting it all to word right. This is what I have so far..

  private void button1_Click(object sender, EventArgs e)
    {
         WebRequest myRequest;
        myRequest = WebRequest.Create("//");
        WebResponse myResponse = myRequest.GetResponse();
        Stream responseStream = myResponse.GetResponseStream();
        StreamReader reader = new StreamReader(responseStream);

        StringBuilder sb = new StringBuilder();
        string line="";
        while ((line = reader.ReadLine()) != null)
        {
            sb.Append(line);
            sb.Append("\r\n");
        }
        richTextBox1.Text = sb.ToString();

    }

,你可以看到这行有这个

as you can see this line has this

 myRequest = WebRequest.Create("//");

作为事实上我有点忘了怎么把它设置为空的用户在里面的信息输入。或者是有办法,当他们点击从HTML的一个消息能拿出在RichTextBox中的文本框和按钮,但显示? 我忘了添加此code

being the fact I kind forget how to have it set to blank for the user to enter in there information. Or is there a way that when they click on From HTML that a messagebox can come up with the textbox and button but displays in the richTextBox? I forgot to add this code

private void fromHTMLToolStripMenuItem_Click(object sender, EventArgs e)
    {

    }

这是哪里的消息框应该是可见一个东西,当用户点击这个按钮,它显示的文本框和按钮,在富文本区域显示HTML。

This is where the messagebox should be a something with visible when the user click this button so it shows the textbox and button to display the HTML in the richtext area.

编辑:我有被称为PANEL1面板组。它具有按钮和文本框中,为用户在他们想要的URL输入。知道我的问题是,当庇隆点击了HTML我需要的面板可见的只有那一个。所以,我会点击面板上的,我怎么会只有只有一个是可见的。

I have a panel group which is called panel1. It has the button and the textbox for the user to enter in the URL that they want to. Know my question is when the peron clicks on From HTML I need to get the panel visible for only that one. So would I click on the panel and how would I only have it visible for only that one.

推荐答案

由于这是家庭作业,我不会给你完整的答案,但这里有一个地方开始:

Since this is homework, I'm not going to give you the full answer, but here's a place to start:

的MessageBox presents与消息的用户,让他点击响应按钮,但你不能将控件添加到它。相反,你必须定义另一种形式的包含您的文本框和确认键,并在处理程序中打开它的 fromHTMLToolStripMenuItem_Click 。可以以这样的形式设置一个属性以保存用户的响应(所需URI),以及事件处理程序中检索它时的形式返回。

MessageBox presents the user with a message and lets him click a button in response, but you can't add controls to it. Instead, you'll have to define another form that contains your textbox and confirmation button, and open it in the handler for fromHTMLToolStripMenuItem_Click. You could set a property in that form to hold the user's response (the desired URI), and retrieve it in the event handler when the form returns.