public void AddPath() { if (ListViewSGLImage.SelectedIndices.Count != 1) { return; } foreach (int index in ListViewSGLImage.SelectedIndices) { bool bIsFind = false; foreach (KeyValuePair <int, CommandBarControl> intItem in m_AddPathList) { if (index == intItem.Key) { bIsFind = true; break; } } if (bIsFind == false) { ListViewSGLImage.Items[index].SubItems[3].Text = "是"; m_AddPathList.Add(index, null); } else { ListViewSGLImage.Items[index].SubItems[3].Text = string.Empty; m_AddPathList.Remove(index); } ListViewSGLImage.RedrawItems(index, index, false); } }
/// <summary> /// /// </summary> public void InsertImage() { #if !DEMO int x = 0; if (int.TryParse(PageOpenImageControl.axFlatEditX.Text, out x) == false) { MessageBox.Show("打开的图像帧的面板中,中心X输入框中输入的数字"); return; } int y = 0; if (int.TryParse(PageOpenImageControl.axFlatEditY.Text, out y) == false) { MessageBox.Show("打开的图像帧的面板中,中心Y输入框中输入的数字"); return; } if (ListViewSGLImage.SelectedIndices.Count != 1) { return; } byte[] imageBuffer = GetImageData(); if (imageBuffer == null) { return; } foreach (int index in ListViewSGLImage.SelectedIndices) { SGLImage sglImage = m_SglFileInfo.SGLImage[index]; foreach (SGLFrame sglFrame in sglImage.SGLFrames) { if (sglFrame.SGLFrameFormat11Or12Or22.DecodeFrame32Stream == null) { if (sglFrame.SGLFrameFormat11Or12Or22.LoadImage() == false) { break; } } } m_SglFileInfo.InsertImage(index, imageBuffer, x, y); int iIndex = 0; ListViewSGLFrame.Items.Clear(); foreach (SGLFrame sglFrame in sglImage.SGLFrames) { ListViewItem listViewItem = new ListViewItem(iIndex.ToString(), 0); listViewItem.SubItems.Add(sglFrame.FrameWidth.ToString()); listViewItem.SubItems.Add(sglFrame.FrameHeight.ToString()); listViewItem.SubItems.Add(sglFrame.CenterX.ToString()); listViewItem.SubItems.Add(sglFrame.CenterY.ToString()); listViewItem.SubItems.Add(sglFrame.BlocksX.ToString()); listViewItem.SubItems.Add(sglFrame.BlocksY.ToString()); ListViewSGLFrame.Items.Add(listViewItem); if (iIndex == 0) { ShowImage(sglImage, sglFrame); } iIndex++; } ListViewSGLImage.Items[index].SubItems[1].Text = "18"; ListViewSGLImage.Items[index].SubItems[2].Text = sglImage.SGLFrames.Length.ToString(); ListViewSGLImage.RedrawItems(index, index, true); } #else MessageBox.Show(TryMessageInfo); #endif }