示例#1
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void frmSec_Load(object sender, EventArgs e)
        {
            OpenFileDialog ofg = new OpenFileDialog();

            ofg.Title            = "Load .sec";
            ofg.Filter           = "Sec files (*.sec)|*.sec";
            ofg.FilterIndex      = 0;
            ofg.RestoreDirectory = true;

            string fn;

            if (ofg.ShowDialog() == DialogResult.OK)
            {
                fn  = ofg.FileName;
                sec = new Sec(fn);
                GenOriginalSketch(1 / zoom, fontsize, fontdisplay);                 //重置视线
            }
            else
            {
                Close();
            }
        }
示例#2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void frmSec_KeyPress(object sender, KeyPressEventArgs e)
        {
            switch (e.KeyChar)
            {
            case 'q':
                Close();
                return;

            case 'x':
                if (zoom + 0.5 <= 16)
                {
                    zoom += 0.5F;
                }
                break;

            case 'z':
                if (zoom - 0.5 > 0.5)
                {
                    zoom -= 0.5F;
                }
                break;

            case '=':
                if (fontsize + 1 <= 12)
                {
                    fontsize++;
                }
                break;

            case '-':
                if (fontsize - 1 >= 2)
                {
                    fontsize--;
                }
                break;

            case 'f':
                fontdisplay = !fontdisplay;
                break;

            case 'o':
                OpenFileDialog ofg = new OpenFileDialog();

                ofg.Title            = "Load .sec";
                ofg.Filter           = "Sec files (*.sec)|*.sec";
                ofg.FilterIndex      = 0;
                ofg.RestoreDirectory = true;

                if (ofg.ShowDialog() == DialogResult.OK)
                {
                    sec = new Sec(ofg.FileName);
                    GenOriginalSketch(1 / zoom, fontsize, fontdisplay);                              //重置视线
                    Refresh();
                }
                return;

            case 's':
                SaveFileDialog sfg = new SaveFileDialog();

                sfg.Title            = "Save to PNG";
                sfg.Filter           = "PNG files (*.png)|*.png";
                sfg.FilterIndex      = 0;
                sfg.RestoreDirectory = true;

                if (sfg.ShowDialog() == DialogResult.OK)
                {
                    bmp.Save(sfg.FileName, ImageFormat.Png);
                }
                else
                {
                    return;
                }
                break;

            default:
                return;
            }
            if (sec != null)
            {
                GenOriginalSketch(1 / zoom, fontsize, fontdisplay);
                Refresh();
            }
        }