feat: 初始化 fl-knowledge 仓库 - 防雷项目源码
This commit is contained in:
@@ -0,0 +1,272 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LP;
|
||||
|
||||
public class FormCreateGanTa : Form
|
||||
{
|
||||
private delegate void delegateFormHide(Form form);
|
||||
|
||||
public FormDesktop desktop = null;
|
||||
|
||||
public int mIndexModel = -1;
|
||||
|
||||
public string mTitle = "";
|
||||
|
||||
private IContainer components = null;
|
||||
|
||||
private Panel panelCreateGanTa;
|
||||
|
||||
private FlowLayoutPanel flowLayoutPanel_Models;
|
||||
|
||||
private Panel panel0;
|
||||
|
||||
private PictureBox pictureBox0;
|
||||
|
||||
private Label label0;
|
||||
|
||||
private Panel panel_North_SerchNameModel;
|
||||
|
||||
private TextBox textBox_Search;
|
||||
|
||||
public FormCreateGanTa()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void FormCreateGanTa_Load(object sender, EventArgs e)
|
||||
{
|
||||
mTitle = "选择杆塔模型";
|
||||
panel0.Visible = false;
|
||||
MyInitControls();
|
||||
Text = mTitle;
|
||||
}
|
||||
|
||||
public void MyInput()
|
||||
{
|
||||
}
|
||||
|
||||
public void MyOutput()
|
||||
{
|
||||
}
|
||||
|
||||
private void MyInitControls()
|
||||
{
|
||||
string value = textBox_Search.Text.Trim();
|
||||
List<string> list = null;
|
||||
list = new List<string>();
|
||||
list.Clear();
|
||||
for (int i = 0; i < GanTas.mName_GanTaModels.Count; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value) || GanTas.mName_GanTaModels[i].IndexOf(value) >= 0)
|
||||
{
|
||||
list.Add(GanTas.mName_GanTaModels[i].Trim());
|
||||
}
|
||||
}
|
||||
flowLayoutPanel_Models.Controls.Clear();
|
||||
for (int j = 0; j < list.Count; j++)
|
||||
{
|
||||
Panel panel = new Panel();
|
||||
panel.Location = panel0.Location;
|
||||
panel.Size = panel0.Size;
|
||||
panel.Tag = list[j];
|
||||
panel.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel.Visible = true;
|
||||
panel.MouseEnter += panel0_MouseEnter;
|
||||
panel.MouseLeave += panel0_MouseLeave;
|
||||
Label label = new Label();
|
||||
label.Font = label0.Font;
|
||||
label.Location = label0.Location;
|
||||
label.Text = list[j];
|
||||
label.AutoSize = true;
|
||||
label.Visible = true;
|
||||
label.Tag = list[j];
|
||||
label.DoubleClick += panel0_DoubleClick;
|
||||
panel.Controls.Add(label);
|
||||
PictureBox pictureBox = new PictureBox();
|
||||
pictureBox.Location = pictureBox0.Location;
|
||||
pictureBox.Size = pictureBox0.Size;
|
||||
pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
string text = Application.StartupPath + "\\" + GanTas.mSubPath_ModelsSimple + "\\" + list[j] + ".jpg";
|
||||
if (File.Exists(text))
|
||||
{
|
||||
Image image = Image.FromFile(text);
|
||||
pictureBox.Image = image;
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox.Image = null;
|
||||
}
|
||||
pictureBox.Visible = true;
|
||||
pictureBox.Tag = list[j];
|
||||
pictureBox.DoubleClick += panel0_DoubleClick;
|
||||
panel.Controls.Add(pictureBox);
|
||||
flowLayoutPanel_Models.Controls.Add(panel);
|
||||
}
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
mTitle = "";
|
||||
}
|
||||
|
||||
private void textBox_Search_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
MyInitControls();
|
||||
}
|
||||
|
||||
private void panel0_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
string text = "";
|
||||
try
|
||||
{
|
||||
text = ((Control)sender).Tag.ToString().Trim();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
text = "";
|
||||
}
|
||||
mIndexModel = -1;
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
for (int i = 0; i < GanTas.mName_GanTaModels.Count; i++)
|
||||
{
|
||||
if (GanTas.mName_GanTaModels[i].Equals(text))
|
||||
{
|
||||
mIndexModel = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
base.DialogResult = DialogResult.OK;
|
||||
MyFormHide(this);
|
||||
}
|
||||
|
||||
private void panel0_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
Control control = (Control)sender;
|
||||
control.BackColor = Color.LightBlue;
|
||||
}
|
||||
|
||||
private void panel0_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
Control control = (Control)sender;
|
||||
control.BackColor = Color.White;
|
||||
}
|
||||
|
||||
public void MyFormHide(Form form)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (form.InvokeRequired)
|
||||
{
|
||||
delegateFormHide method = MyFormHide;
|
||||
form.Invoke(method, form);
|
||||
}
|
||||
else
|
||||
{
|
||||
form.Hide();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panelCreateGanTa = new System.Windows.Forms.Panel();
|
||||
this.flowLayoutPanel_Models = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panel0 = new System.Windows.Forms.Panel();
|
||||
this.pictureBox0 = new System.Windows.Forms.PictureBox();
|
||||
this.label0 = new System.Windows.Forms.Label();
|
||||
this.panel_North_SerchNameModel = new System.Windows.Forms.Panel();
|
||||
this.textBox_Search = new System.Windows.Forms.TextBox();
|
||||
this.panelCreateGanTa.SuspendLayout();
|
||||
this.flowLayoutPanel_Models.SuspendLayout();
|
||||
this.panel0.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)this.pictureBox0).BeginInit();
|
||||
this.panel_North_SerchNameModel.SuspendLayout();
|
||||
base.SuspendLayout();
|
||||
this.panelCreateGanTa.Controls.Add(this.flowLayoutPanel_Models);
|
||||
this.panelCreateGanTa.Controls.Add(this.panel_North_SerchNameModel);
|
||||
this.panelCreateGanTa.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelCreateGanTa.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelCreateGanTa.Name = "panelCreateGanTa";
|
||||
this.panelCreateGanTa.Size = new System.Drawing.Size(854, 450);
|
||||
this.panelCreateGanTa.TabIndex = 0;
|
||||
this.flowLayoutPanel_Models.AutoScroll = true;
|
||||
this.flowLayoutPanel_Models.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.flowLayoutPanel_Models.Controls.Add(this.panel0);
|
||||
this.flowLayoutPanel_Models.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel_Models.Location = new System.Drawing.Point(0, 48);
|
||||
this.flowLayoutPanel_Models.Name = "flowLayoutPanel_Models";
|
||||
this.flowLayoutPanel_Models.Size = new System.Drawing.Size(854, 402);
|
||||
this.flowLayoutPanel_Models.TabIndex = 1;
|
||||
this.panel0.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel0.Controls.Add(this.label0);
|
||||
this.panel0.Controls.Add(this.pictureBox0);
|
||||
this.panel0.Location = new System.Drawing.Point(3, 3);
|
||||
this.panel0.Name = "panel0";
|
||||
this.panel0.Size = new System.Drawing.Size(200, 216);
|
||||
this.panel0.TabIndex = 0;
|
||||
this.panel0.DoubleClick += new System.EventHandler(panel0_DoubleClick);
|
||||
this.panel0.MouseEnter += new System.EventHandler(panel0_MouseEnter);
|
||||
this.panel0.MouseLeave += new System.EventHandler(panel0_MouseLeave);
|
||||
this.pictureBox0.Location = new System.Drawing.Point(12, 30);
|
||||
this.pictureBox0.Name = "pictureBox0";
|
||||
this.pictureBox0.Size = new System.Drawing.Size(175, 169);
|
||||
this.pictureBox0.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox0.TabIndex = 1;
|
||||
this.pictureBox0.TabStop = false;
|
||||
this.label0.AutoSize = true;
|
||||
this.label0.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
||||
this.label0.Location = new System.Drawing.Point(66, 4);
|
||||
this.label0.Name = "label0";
|
||||
this.label0.Size = new System.Drawing.Size(56, 16);
|
||||
this.label0.TabIndex = 1;
|
||||
this.label0.Text = "label1";
|
||||
this.label0.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
this.panel_North_SerchNameModel.Controls.Add(this.textBox_Search);
|
||||
this.panel_North_SerchNameModel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel_North_SerchNameModel.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel_North_SerchNameModel.Name = "panel_North_SerchNameModel";
|
||||
this.panel_North_SerchNameModel.Size = new System.Drawing.Size(854, 48);
|
||||
this.panel_North_SerchNameModel.TabIndex = 0;
|
||||
this.textBox_Search.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
||||
this.textBox_Search.Location = new System.Drawing.Point(311, 12);
|
||||
this.textBox_Search.Name = "textBox_Search";
|
||||
this.textBox_Search.Size = new System.Drawing.Size(173, 26);
|
||||
this.textBox_Search.TabIndex = 0;
|
||||
this.textBox_Search.TextChanged += new System.EventHandler(textBox_Search_TextChanged);
|
||||
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
|
||||
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
base.ClientSize = new System.Drawing.Size(854, 450);
|
||||
base.Controls.Add(this.panelCreateGanTa);
|
||||
base.Name = "FormCreateGanTa";
|
||||
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "FormCreateGanTa";
|
||||
base.Load += new System.EventHandler(FormCreateGanTa_Load);
|
||||
this.panelCreateGanTa.ResumeLayout(false);
|
||||
this.flowLayoutPanel_Models.ResumeLayout(false);
|
||||
this.panel0.ResumeLayout(false);
|
||||
this.panel0.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)this.pictureBox0).EndInit();
|
||||
this.panel_North_SerchNameModel.ResumeLayout(false);
|
||||
this.panel_North_SerchNameModel.PerformLayout();
|
||||
base.ResumeLayout(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user