예제 #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }

            if (dataGridView1.Columns[e.ColumnIndex].Name == "col_Copy")
            {
                VirtualChannel chan = (VirtualChannel)dataGridView1.Rows[e.RowIndex].Tag;
                if (chan.VirtualType == VirtualChannelType.Copy)
                {
                    SelectSubChannelDlg dlg = new SelectSubChannelDlg((VirtualFixture)mFixture, chan);
                    dlg.ShowDialog(this);
                }
            }
        }
예제 #2
0
파일: ChanBtn.cs 프로젝트: sebsegard/Perso
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }

            if (dataGridView1.Columns[e.ColumnIndex].Name == "col_Image")
            {
                string ImagePath = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText;

                Dialog.ImageBrowser Browser = new DmxCreator.Dialog.ImageBrowser(ImagePath);
                //Browser.SelectImage(ImagePath);
                DialogResult res = Browser.ShowDialog();
                if (res != DialogResult.OK)
                {
                    return;
                }

                string DestFile = Browser.SelectedImage;


                if (mFixture is RealFixture)
                {
                    FileInfo Info    = new FileInfo(Browser.SelectedImage);
                    string   DestDir = Constant.FixtureDir + "\\" + ((RealFixture)mFixture).LightConstructor + "\\" + ((RealFixture)mFixture).LightName + "\\img";
                    if (!Directory.Exists(DestDir))
                    {
                        Directory.CreateDirectory(DestDir);
                    }
                    DestFile = DestDir + "\\" + Info.Name;
                    if (!File.Exists(DestFile))
                    {
                        File.Copy(Browser.SelectedImage, DestFile);
                    }
                }
                else
                {
                    FileInfo Info = new FileInfo(Browser.SelectedImage);
                    DestFile = Constant.VirtualDir + "\\" + Info.Name;
                    if (!File.Exists(DestFile))
                    {
                        File.Copy(Browser.SelectedImage, DestFile);
                    }
                }

                DmxValue val = (DmxValue)this.dataGridView1.Rows[e.RowIndex].Tag;
                val.Image = DestFile;

                this.dataGridView1.Rows[e.RowIndex].Cells["col_Image"].ToolTipText = val.Image;
                if (val.Image != null && val.Image != "")
                {
                    ((DataGridViewImageCell)(this.dataGridView1.Rows[e.RowIndex].Cells["col_Image"])).Value = Image.FromFile(val.Image);
                }
            }
            else if (dataGridView1.Columns[e.ColumnIndex].Name == "col_Copy")
            {
                SelectSubChannelDlg dlg = new SelectSubChannelDlg((VirtualFixture)mFixture, (VirtualChannel)mChannel, (DmxValue)dataGridView1.Rows[e.RowIndex].Tag);
                dlg.ShowDialog(this);
            }
        }