示例#1
0
        /// <summary>
        /// 属性窗口改变后,更新表格中界面的显示
        /// </summary>
        /// <param Name="s"></param>
        /// <param Name="e"></param>
        void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            DataGridViewRowChild child = this.propertyGrid1.SelectedObject as DataGridViewRowChild;

            if (child == null)
            {
                return;
            }

            child.SetValues(child.Attrib.Bitmap.ShowName);
        }
示例#2
0
        /// <summary>
        /// 表格单元格选中后的事件响应
        /// 这里主要是将表格中选中的单元格对象图片属性进行显示
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        void dataGridView_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewCell vCell in this.dataGridView.SelectedCells)
            {
                DataGridViewRowChild vv = vCell.OwningRow as DataGridViewRowChild;
                if (vv == null)
                {
                    continue;
                }

                //if (!vv.Attrib.Bitmap.isValidShow())
                //    continue;

                this.propertyGrid1.SelectedObject = vv;
            }
        }
示例#3
0
        /// <summary>
        /// 初始化构造函数
        /// </summary>
        /// <param Name="array">初始化图片数组</param>
        /// <param Name="count">最大图片个数</param>
        public SVBitmapArrayWindow(SVBitmapArray array, Int32 count = 8)
        {
            InitializeComponent();

            ///相关事件注册
            this.dataGridView.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridView.AllowUserToAddRows  = false;
            this.dataGridView.RowPostPaint       += new DataGridViewRowPostPaintEventHandler(dataGridView_RowPostPaint);
            this.dataGridView.Click += new EventHandler(dataGridView_Click);
            this.propertyGrid1.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid1_PropertyValueChanged);

            _bitArray = array;

            ///在表格中,添加最大行
            for (int i = 0; i < count; i++)
            {
                DataGridViewRowChild v = new DataGridViewRowChild();
                dataGridView.Rows.Add(v);
            }

            if (array.BitmapArray == null)
            {
                return;
            }

            Int32 minValue = Math.Min(count, array.BitmapArray.Count);

            for (int i = 0; i < minValue; i++)
            {
                SVBitmap vTmp = array.BitmapArray[i];
                if (vTmp == null)
                {
                    continue;
                }

                DataGridViewRowChild vv = dataGridView.Rows[i] as DataGridViewRowChild;
                vv.Attrib.Bitmap = vTmp;
                dataGridView.Rows[i].SetValues(vTmp.ShowName);
            }
        }
示例#4
0
        /// <summary>
        /// 单击OK按钮的事件响应
        /// 记录当前用户选择的图片数组数据
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            List <SVBitmap> list = new List <SVBitmap>();

            for (int i = 0; i < this.dataGridView.RowCount; i++)
            {
                DataGridViewCell     vCell = this.dataGridView[0, i];
                DataGridViewRowChild vv    = vCell.OwningRow as DataGridViewRowChild;
                if (vv == null)
                {
                    continue;
                }

                if (!vv.Attrib.Bitmap.isValidShow())
                {
                    continue;
                }

                list.Add(vv.Attrib.Bitmap);
            }

            _bitArray.BitmapArray = list;
            this.DialogResult     = System.Windows.Forms.DialogResult.Yes;
        }