public VisualSort2(VisualSort1 form) { InitializeComponent(); this.form = form; picNumber = 1; sa = new SortAlg2(); listList = new List<List<int>>(); #region 初始化ComboBox comboBox1.Items.AddRange(new object[] { "请选择排序算法"}); comboBox1.Items.AddRange(new object[] { "冒泡排序"}); comboBox1.Items.AddRange(new object[] { "双向冒泡排序"}); comboBox1.Items.AddRange(new object[] { "梳排序"}); comboBox1.Items.AddRange(new object[] { "插入排序"}); comboBox1.Items.AddRange(new object[] { "选择排序"}); comboBox1.Items.AddRange(new object[] { "希尔排序"}); comboBox1.Items.AddRange(new object[] { "堆排序"}); comboBox1.Items.AddRange(new object[] { "归并排序"}); comboBox1.Items.AddRange(new object[] { "快速排序"}); comboBox1.Items.AddRange(new object[] { "地精排序"}); comboBox1.Items.AddRange(new object[] { "使用冒泡的快速排序"}); comboBox1.Items.AddRange(new object[] { "桶排序"}); comboBox1.Items.AddRange(new object[] { "圈排序"}); comboBox1.Items.AddRange(new object[] { "奇偶排序"}); comboBox1.Items.AddRange(new object[] { "鸽巢排序"}); comboBox1.SelectedIndex = 0; #endregion listView.View = View.Details;//设置视图 listView.GridLines = true; //显示表格线 listView.View = View.Details;//显示表格细节 listView.LabelEdit = true; //是否可编辑,ListView只可编辑第一列。 listView.Scrollable = true;//有滚动条 //listView.HeaderStyle = ColumnHeaderStyle.Nonclickable;//对表头进行设置 listView.FullRowSelect = true;//是否可以选择行 this.MinimumSize = new Size(760, 540); }
public SortAlgorithm(PictureGroup picGru, VisualSort1 form, int s) { list = picGru.list; pictureBox = picGru.pictureBox; g = picGru.g; bitmap = picGru.bitmap; speed = s; pictureBox.Image = bitmap; this.form = form; picGroup = picGru; form.DrawBitmap(); }
public PictureGroup(VisualSort1 form, Point point, Size size) { Init(form, point, size); }
private void Init(VisualSort1 form, Point point, Size size) { pictureBox = new PictureBox(); comboBox = new ComboBox(); TimeLabel = new Label(); DateTime time = DateTime.Now; this.form = form; this.speed = 20; //PictureBox pictureBox.BackColor = Color.White; pictureBox.BorderStyle = BorderStyle.FixedSingle; pictureBox.Location = new Point(point.X, point.Y); pictureBox.Name = "pictureBox"; pictureBox.Size = size; pictureBox.TabStop = false; // comboBox1 comboBox.FormattingEnabled = true; comboBox.Location = new Point(point.X, point.Y + pictureBox.Size.Height + 10); comboBox.Name = "comboBox"; comboBox.Size = new Size(pictureBox.Size.Width, 20); comboBox.Items.AddRange(new object[] { "请选择排序算法"}); comboBox.Items.AddRange(new object[] { "冒泡排序"}); comboBox.Items.AddRange(new object[] { "双向冒泡排序"}); comboBox.Items.AddRange(new object[] { "梳排序"}); comboBox.Items.AddRange(new object[] { "插入排序"}); comboBox.Items.AddRange(new object[] { "选择排序"}); comboBox.Items.AddRange(new object[] { "希尔排序"}); comboBox.Items.AddRange(new object[] { "堆排序"}); comboBox.Items.AddRange(new object[] { "归并排序"}); comboBox.Items.AddRange(new object[] { "快速排序"}); comboBox.Items.AddRange(new object[] { "地精排序"}); comboBox.Items.AddRange(new object[] { "使用冒泡的快速排序"}); comboBox.Items.AddRange(new object[] { "桶排序"}); comboBox.Items.AddRange(new object[] { "圈排序"}); comboBox.Items.AddRange(new object[] { "奇偶排序"}); comboBox.Items.AddRange(new object[] { "鸽巢排序"}); comboBox.SelectedIndex = 0; // label3 TimeLabel.AutoSize = true; TimeLabel.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))); TimeLabel.Location = new Point(point.X, comboBox.Location.Y + comboBox.Size.Height + 10); TimeLabel.Name = "timeLabel"; TimeLabel.Size = new Size(49, 14); TimeLabel.Text = "时间:00:00:00"; bitmap = new Bitmap(pictureBox.Width, pictureBox.Height); g = Graphics.FromImage(bitmap); pictureBox.Image = bitmap; form.Controls.Add(pictureBox); form.Controls.Add(comboBox); form.Controls.Add(TimeLabel); }