// <summary>
        /// Show details when row is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in itemGrid.SelectedRows)
            {
                richTextBoxInfo.Clear();
                richTextBoxInfo.AppendText("@@@INSERTED_RTF_CODE_HACK@@@");
                string rtf = "";

                if ((string)row.Cells[itemTypeDataGridViewTextBoxColumn.Index].Value == "ships")
                {
                    rtf += FLUtility.FLXmlToRtf((string)row.Cells[iDSInfo1DataGridViewTextBoxColumn.Index].Value);
                    rtf += "\\pard \\par ";
                    rtf += FLUtility.FLXmlToRtf((string)row.Cells[iDSInfoDataGridViewTextBoxColumn.Index].Value);
                }
                else
                {
                    string xml = (string)row.Cells[iDSInfoDataGridViewTextBoxColumn.Index].Value;
                    if (xml.Length == 0)
                    {
                        xml = "No information available";
                    }
                    rtf += FLUtility.FLXmlToRtf(xml);
                }
                richTextBoxInfo.Rtf = richTextBoxInfo.Rtf.Replace("@@@INSERTED_RTF_CODE_HACK@@@", rtf);
                break;
            }
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: DiscoveryGC/Navmap
        private void dataGridViewIDS_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridViewRow row = dataGridViewIDS.Rows[e.RowIndex];
                textBoxCardInfo.Text    = row.Cells[0].Value.ToString();
                richTextBoxRawCard.Text = row.Cells[1].Value.ToString();

                richTextBoxFormattedCard.Clear();
                richTextBoxFormattedCard.AppendText("@@@INSERTED_RTF_CODE_HACK@@@");
                string rtf = FLUtility.FLXmlToRtf(row.Cells[1].Value.ToString());
                richTextBoxFormattedCard.Rtf = richTextBoxFormattedCard.Rtf.Replace("@@@INSERTED_RTF_CODE_HACK@@@", rtf);
            }
            catch
            {
                textBoxCardInfo.Clear();
                richTextBoxRawCard.Clear();
                richTextBoxFormattedCard.Clear();
            }
        }