Example #1
0
        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);
            }
        }
Example #2
0
        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            e.Cancel = true;

            if (ListViewSGLImage.SelectedIndices.Count != 1)
            {
                return;
            }

            ListViewHitTestInfo listViewHitTestInfo = ListViewSGLImage.HitTest(ListViewSGLImage.PointToClient(Cursor.Position));

            if (listViewHitTestInfo == null)
            {
                return;
            }

            if (listViewHitTestInfo.Item == null)
            {
                return;
            }

            CommandBar        popupCommandBar2   = m_SGLEditorForm.axCommandBars.Add("SGLImagePopup1", XTPBarPosition.xtpBarPopup);
            CommandBarControl commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlCheckBox, ResourceID.ID_SGL_ADD_PATH, "加入补丁列表(&A)", -1, false);

            commandBarControl2         = popupCommandBar2.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_INSERT_MULTI_IMAGE, "插入多帧的文件(&I)", -1, false);
            commandBarControl2.Enabled = true;

            bool bIsFind = false;

            foreach (KeyValuePair <int, CommandBarControl> intItem in m_AddPathList)
            {
                if (intItem.Key == listViewHitTestInfo.Item.Index)
                {
                    bIsFind = true;
                    break;
                }
            }
            commandBarControl2.Checked = bIsFind;

            popupCommandBar2.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null);
        }
Example #3
0
        /// <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
        }