可以用visual studio2005打开visual studio2008所建的项目吗?要怎样打开呢?
问题如标题,求教!
微软一直都是向后兼容,没有向前兼容的。
重新建项目,把源码资源什么的加进去吧。
using System; using System.Collections.Generic; using using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace MyPaint { public partial class MainForm : Form { DrawTool currentTool; Image image; Matrix matrix; string path = null; public Matrix Matrix { get { return matrix; } set { matrix = value; } } /// <summary> /// 获取当前图像 /// </summary> public Image Image { get { return image; } } OpenFileDialog opdlg = new OpenFileDialog(); SaveFileDialog sfdlg = new SaveFileDialog(); public MainForm() { InitializeComponent(); matrix = new Matrix(); CreateTools(); currentTool = null; sfdlg.Filter = opdlg.Filter = "位图文件(*.bmp)|*.bmp||"; NewFile(); } //创建要使用的工具 private void CreateTools() { DrawTool[] tools = new DrawTool[]{new Zoom(), new MyPen()}; int x, y, c; x = y = c = 0; foreach (DrawTool tool in tools) { RadioButton rb = new RadioButton(); pnlTools.Controls.Add(rb); rb.Appearance = Appearance.Button; rb.FlatStyle = FlatStyle.Flat; rb.Image = tool.ToolImage; rb.TextImageRelation = TextImageRelation.Overlay; rb.Left = x; rb.Top = y; rb.AutoSize = false; rb.Width = 32; rb.Height = 32; rb.Tag = tool; if (c++ % 2 > 0) //换行 { x = 0; y = rb.Bottom + 3; } else { x = rb.Right + 3; } rb.CheckedChanged += new EventHandler(ToolButtonChange); } } void ToolButtonChange(object sender, EventArgs e) { RadioButton rb = sender as RadioButton; if (!rb.Checked) return; if (currentTool != null) currentTool.Clear(this); currentTool = rb.Tag as DrawTool; pnlPaint.Cursor = currentTool.ToolCursor; pnlPaint.Refresh(); } /// <summary> /// 绘制图像 /// </summary> public void PaintImage() { Graphics g = pnlPaint.CreateGraphics(); g.PageUnit = GraphicsUnit.Pixel; g.Transform = matrix; g.DrawImage(image, 0, 0); pnlPaint.Size = g.ClipBounds.Size.ToSize(); g.Dispose(); } private void pnlPaint_Paint(object sender, PaintEventArgs e) { PaintImage(); } private void NewFile() { path = null; image = new Bitmap(640, 480); Graphics g = Graphics.FromImage(image); g.Clear(Color.White); g.Dispose(); } private void OnNewFile(object sender, EventArgs e) { NewFile(); } private void OpenFile(object sender, EventArgs e) { if (opdlg.ShowDialog(this) != DialogResult.OK) return; image = Image.FromFile(opdlg.FileName); pnlPaint.Refresh(); } private void pnlPaint_MouseClick(object sender, MouseEventArgs e) { if (currentTool == null) return; Graphics g = pnlPaint.CreateGraphics(); pnlPaint.Cursor = currentTool.ToolCursor; currentTool.OnMouseClick(this, e); g.Dispose(); pnlPaint.Refresh(); } private void MainForm_KeyDown(object sender, KeyEventArgs e) { if (currentTool != null) { currentTool.OnKeyDown(this, e); } } private void MainForm_KeyUp(object sender, KeyEventArgs e) { if (currentTool != null) { currentTool.OnKeyUp(this, e); } } private void pnlPaint_MouseMove(object sender, MouseEventArgs e) { if (currentTool != null) { currentTool.OnMouseMove(this, e); } } private void OnSave(object sender, EventArgs e) { if (path == null) OnSaveAs(null, null); else image.Save(path); } private void OnSaveAs(object sender, EventArgs e) { if (sfdlg.ShowDialog(this) != DialogResult.OK) return; path = sfdlg.FileName; OnSave(null, null); } } }