private void copyToToolStripMenuItem_Click(object sender, EventArgs e) { if (PreviewListView.SelectedIndices.Count == 0) { return; } if (SaveLibraryDialog.ShowDialog() != DialogResult.OK) { return; } MLibrary tempLibrary = new MLibrary(SaveLibraryDialog.FileName); List <int> copyList = new List <int>(); for (int i = 0; i < PreviewListView.SelectedIndices.Count; i++) { copyList.Add(PreviewListView.SelectedIndices[i]); } copyList.Sort(); for (int i = 0; i < copyList.Count; i++) { MLibrary.MImage image = _library.GetMImage(copyList[i]); tempLibrary.AddImage(image.Image, image.X, image.Y); } tempLibrary.Save(); }
private void OffSetYTextBox_TextChanged(object sender, EventArgs e) { TextBox control = sender as TextBox; if (control == null || !control.Focused) { return; } short temp; if (!short.TryParse(control.Text, out temp)) { control.BackColor = Color.Red; return; } control.BackColor = SystemColors.Window; for (int i = 0; i < PreviewListView.SelectedIndices.Count; i++) { MLibrary.MImage image = _library.GetMImage(PreviewListView.SelectedIndices[i]); image.Y = temp; } }
private void ClearInterface() { _selectedImage = null; ImageBox.Image = null; WidthLabel.Text = "<No Image>"; HeightLabel.Text = "<No Image>"; OffSetXTextBox.Text = string.Empty; OffSetYTextBox.Text = string.Empty; OffSetXTextBox.BackColor = SystemColors.Window; OffSetYTextBox.BackColor = SystemColors.Window; }
private void PreviewListView_SelectedIndexChanged(object sender, EventArgs e) { if (PreviewListView.SelectedIndices.Count == 0) { ClearInterface(); return; } _selectedImage = _library.GetMImage(PreviewListView.SelectedIndices[0]); if (_selectedImage == null) { ClearInterface(); return; } OffSetXTextBox.Text = _selectedImage.X.ToString(); OffSetYTextBox.Text = _selectedImage.Y.ToString(); ImageBox.Image = _selectedImage.Image; ////---------------------这里写黑边代码------------------- //Texture ImageFuZhi = new Texture(DXManager.Device, _selectedImage._Image.Width, _selectedImage._Image.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed); //GraphicsStream stream = ImageFuZhi.LockRectangle(0, LockFlags.Discard); //byte[] decomp = BitmapToBytes(_selectedImage._Image); //stream.Write(decomp, 0, decomp.Length); //stream.Dispose(); //ImageFuZhi.UnlockRectangle(0); ////------------------------------------- // Keep track of what image/s are selected. if (PreviewListView.SelectedIndices.Count > 1) { toolStripStatusLabel.ForeColor = Color.Red; toolStripStatusLabel.Text = "Multiple images selected."; } else { toolStripStatusLabel.ForeColor = SystemColors.ControlText; toolStripStatusLabel.Text = "Selected Image: " + string.Format("{0} / {1}", PreviewListView.SelectedIndices[0].ToString(), (PreviewListView.Items.Count - 1).ToString()); } nudJump.Value = PreviewListView.SelectedIndices[0]; }
private void PreviewListView_SelectedIndexChanged(object sender, EventArgs e) { if (PreviewListView.SelectedIndices.Count == 0) { ClearInterface(); return; } _selectedImage = _library.GetMImage(PreviewListView.SelectedIndices[0]); if (_selectedImage == null) { ClearInterface(); return; } WidthLabel.Text = _selectedImage.Width.ToString(); HeightLabel.Text = _selectedImage.Height.ToString(); OffSetXTextBox.Text = _selectedImage.X.ToString(); OffSetYTextBox.Text = _selectedImage.Y.ToString(); ImageBox.Image = _selectedImage.Image; }
private void PreviewListView_SelectedIndexChanged(object sender, EventArgs e) { if (PreviewListView.SelectedIndices.Count == 0) { ClearInterface(); return; } _selectedImage = _library.GetMImage(PreviewListView.SelectedIndices[0]); if (_selectedImage == null) { ClearInterface(); return; } WidthLabel.Text = _selectedImage.Width.ToString(); HeightLabel.Text = _selectedImage.Height.ToString(); OffSetXTextBox.Text = _selectedImage.X.ToString(); OffSetYTextBox.Text = _selectedImage.Y.ToString(); ImageBox.Image = _selectedImage.Image; // Keep track of what image/s are selected. if (PreviewListView.SelectedIndices.Count > 1) { toolStripStatusLabel.ForeColor = Color.Red; toolStripStatusLabel.Text = "Multiple images selected."; } else { toolStripStatusLabel.ForeColor = SystemColors.ControlText; toolStripStatusLabel.Text = "Selected Image: " + string.Format("{0} / {1}", PreviewListView.SelectedIndices[0].ToString(), (PreviewListView.Items.Count - 1).ToString()); } nudJump.Value = PreviewListView.SelectedIndices[0]; }