Вход на сайт
Bred cs 22.03.2025
382
22.03.25 06:19
Последний раз изменено 22.03.25 06:23 (uscheswoi_82)
Всем привет!
Я ещё кое-что запрограммировал на C# 4.0:
Program.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Bred {
class Program {
static void Main(string[] args) {
Form f = new Form();
f.Title = "Web Forma";
Button b = new Button("Knopka", "Form2");
Label l = new Label("AAA" + Environment.GetEnvironmentVariable("REQUEST_METHOD"));
f.Add(l);
f.Add(b);
}
}
}
Form.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Bred {
class Form {
public String Title { get; set; }
private String strComponents;
public Form() {
strComponents = "";
}
public void Add(Control c) {
strComponents += c.Show();
}
public String Show() {
String strWindow = "<div style=\"background-color:lightgray; width:640px; height:480px; border:2px solid #eee;\">" +
<div style=\"width:100%; height:20px; background-color:blue; color:#fff;\">" +
Title + " </div>" + strComponents + "</div>";
String strBuf = "Content-Type:text/html\n\n\r\r";
strBuf += "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title>" + Title +
"</title></head><body>" + strWindow + "</body></html>\n\r";
return strBuf;
}
}
}
Control.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Bred {
class Control {
public Control() { }
public virtual String Show() {
return "";
}
}
}
Buton.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Bred {
class Button : Control {
private String strText;
private String strForm;
public Button(String strText, String strForm) : base() {
this.strText = strText;
this.strForm = strForm;
}
public override String Show()
{
return "<form method=\"post\"><input type=\"hidden\" name=\"form\" value=\"" +
strForm +
"\"><input type=\"submit\" style=\"border:3px outter #eee;\" value=\"" +
strText + "\" />";
}
}
}
Program.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Bred {
class Label : Control {
private String strText;
public Label(String strText) : base() {
this.strText = strText;
}
public override String Show() {
return "<label>" + strText + "</lable>";
}
}
}
Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнение
Моя ФЛ Он и Она
Моя ФЛ Он и Она
NEW 22.03.25 06:24
в ответ uscheswoi_82 22.03.25 06:19
Вуаля! А вот и результат:

Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнение
Моя ФЛ Он и Она
Моя ФЛ Он и Она
список