111,094
社区成员




public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 3; i++)
{
Button button = new Button() { Text = "Button_" + i, Location = new Point(10, 10+i*30), };
button.Click += (s, e) => { Show_Value(i); };
this.Controls.Add(button);
}
}
private void Show_Value(int value)
{
MessageBox.Show(value.ToString());
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 3; i++)
{
int u = i;
Button button = new Button() { Text = "Button_" + i, Location = new Point(10, 10+i*30), };
button.Click += (s, e) => { Show_Value(u); };
this.Controls.Add(button);
}
}
private void Show_Value(int value)
{
MessageBox.Show(value.ToString());
}
}
if (type == 11 || type == 12) // 进度文字、安装文件详细信息
{
for (int i = 0; i < Base_Label.Length + Font_Label.Length - 1; i++)
{
Label label = new Label();
if (i < Base_Label.Length) label.Content = Base_Label[i];
else label.Content = Font_Label[i - Base_Label.Length];
Functionality.Set_ControlPosition(label, 5, 5 + i * 25);
Value_Box[type].Children.Add(label);
if (i < Base_Label.Length - 1 || i == 9 || i == 10)
{
TextBox Input_Box = new TextBox() { Width = 90, Height = 16, };
Functionality.Set_ControlPosition(Input_Box, 70, 10 + i * 25);
Value_Box[type].Children.Add(Input_Box);
}
else
if (i == 8 || i == 11)
{
Color color = i == 8 ? Color.FromRgb(255, 255, 255) : Color.FromRgb(0, 0, 0);
int t = i; // 这里,开始没有加上,老是不对
Canvas Color_Flag = new Canvas() { Width = 50, Height = 16, Background = new SolidColorBrush(color), Tag = "flag" };
Functionality.Set_ControlPosition(Color_Flag, 90, 210 + (i - 8) * 25);
Value_Box[type].Children.Add(Color_Flag);
Image Image_Button = new Image() { Width = 20, Height = 20, Source = new BitmapImage(new Uri("Images/color.png", UriKind.RelativeOrAbsolute)), };
Functionality.Set_ControlPosition(Image_Button, 165, 208 + (i - 8) * 25);
Image_Button.MouseDown += (s, e) =>
{
new Element_SetColor(
GetAbsolutePlacement(Image_Button, true).X,
GetAbsolutePlacement(Image_Button, true).Y - 420,
type, t // 这里,开始没有加上,老是不对
).ShowDialog();
};
Value_Box[type].Children.Add(Image_Button);
}
}
Image SelFont_Image = new Image() { Width = 15, Height = 17, Source = new BitmapImage(new Uri("Images/sel_btn.png", UriKind.RelativeOrAbsolute)), };
Functionality.Set_ControlPosition(SelFont_Image, 168, 235);
Value_Box[type].Children.Add(SelFont_Image);
Value_Box[type].Height = Max_Height > 305 ? Max_Height : 305;
}