📄 sortbase.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;
namespace GraphicsSort
{
public delegate void StepComplete(object sender, StepEventArgs e);
public delegate void SortComplete(object sender, SortEventArgs e);
public abstract class SortBase
{
public int[] list;
public Control ctl;
public Mutex mut;
public int SwapCount;
public Bitmap bmp;
public StepEventArgs e;
protected string SortName;
private bool _bIsComplete;
private object o = new object();
public bool IsComplete
{
get
{
return _bIsComplete;
}
set
{
lock (o)
{
_bIsComplete = value;
}
}
}
public string Name
{
get { return SortName; }
}
public SortBase(string SortName, int[] initList, System.Windows.Forms.Control ctlToDraw)
{
this.SortName = SortName;
ctl = ctlToDraw;
list = new int[initList.Length];
mut = new Mutex();
for (int i = 0; i < initList.Length; i++)
{
list[i] = initList[i];
}
bmp = new Bitmap(ctl.Width, ctl.Height);
e = new StepEventArgs();
e.list = list;
e.sortBase = this;
e.bmp = bmp;
}
public virtual event StepComplete stepComplete;
public virtual event SortComplete sortComplete;
}
public class StepEventArgs: EventArgs
{
public int [] list;
public SortBase sortBase;
public Bitmap bmp;
}
public class SortEventArgs : EventArgs
{
public string SortName;
public int SwapCount;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -