コード例 #1
0
        private void AddFormatToList(Shape shape, string name, FormatTreeNode[] formats)
        {
            string shapeKey = CopyShape(shape, formats);

            if (shapeKey == null)
            {
                MessageBox.Show(SyncLabText.ErrorCopy);
                return;
            }
            SyncFormatPaneItem item = new SyncFormatPaneItem(this, shapeKey, shapeStorage, formats);

            item.Text  = name;
            item.Image = new System.Drawing.Bitmap(GraphicsUtil.ShapeToBitmap(shape));
            formatListBox.Items.Insert(0, item);
            formatListBox.SelectedIndex = 0;
        }
コード例 #2
0
        public void ClearInvalidFormats()
        {
            int index = 0;

            while (index < formatListBox.Items.Count)
            {
                SyncFormatPaneItem item = formatListBox.Items[index] as SyncFormatPaneItem;
                if (item.FormatShapeExists)
                {
                    index++;
                }
                else
                {
                    formatListBox.Items.RemoveAt(index);
                }
            }
        }