private void button1_Click(object sender, EventArgs e) { db.OpenDB(); int a = db.BorrarNombre(textBox1.Text); DataTable dt = db.getAll(); dataGridView1.DataSource = dt; dataGridView1.Refresh(); db.closeDB(); }
private void guardarImagenToolStripMenuItem_Click_1(object sender, EventArgs e) { db.OpenDB(); var bmpScreenshot = new Bitmap(ClientSize.Width + 40, ClientSize.Height - 50, PixelFormat.Format32bppArgb); // Crea los gráficos del Bitmap. var gfxScreenshot = Graphics.FromImage(bmpScreenshot); //Marca los puntos laterales gfxScreenshot.CopyFromScreen(Location.X, Location.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "JPEG|*.jpeg"; DialogResult dr = sfd.ShowDialog(); if (dr == DialogResult.OK) { bmpScreenshot.Save(sfd.FileName, ImageFormat.Png); int a = db.AñadirImagen(Path.GetFileNameWithoutExtension(sfd.FileName), Path.GetExtension(sfd.FileName), Convert.ToInt32(new System.IO.FileInfo(sfd.FileName).Length)); MessageBox.Show("Imagen guardada en formato jpeg"); } db.closeDB(); }
public DBForm() { InitializeComponent(); db = new DBGestion(dbLocation); int res = db.OpenDB(); if (res != 0) { MessageBox.Show("Error abriendo la base de datos"); } }
public void sakvarToolStripMenuItem_Click(object sender, EventArgs e) { db.OpenDB(); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "PPM|*.ppm"; DialogResult dr = sfd.ShowDialog(); if (dr == DialogResult.OK) { img.GuardarImagen(sfd.FileName); int a = db.AñadirImagen(Path.GetFileNameWithoutExtension(sfd.FileName), Path.GetExtension(sfd.FileName), Convert.ToInt32(new System.IO.FileInfo(sfd.FileName).Length)); MessageBox.Show("Imagen guardada correctamente"); } else { MessageBox.Show("Error de carga"); } db.closeDB(); }
private void button1_Click_1(object sender, EventArgs e) { db.OpenDB(); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "PPM|*.ppm"; DialogResult dr = sfd.ShowDialog(); if (dr == DialogResult.OK) { pictureBox1.Image = (Image)Bitmap; pictureBox1.Image.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Bmp); int a = db.AñadirImagen(Path.GetFileNameWithoutExtension(sfd.FileName), Path.GetExtension(sfd.FileName), Convert.ToInt32(new System.IO.FileInfo(sfd.FileName).Length)); MessageBox.Show("Imagen guardada correctamente"); } else { MessageBox.Show("Error de carga"); } db.closeDB(); this.Close(); }