Example #1
0
        /// <summary>
        /// “复制计划” 按钮的事件响应函数。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCopyForecastNumberList_Click(object sender, EventArgs e)
        {
            string forecastNumbers = string.Join(" ", mgr.GetNextPlanForecastList());

            Clipboard.SetText(forecastNumbers);
            AutoDelayCloseMessageBox.Show("复制成功", delayCloseMilliseconds);
            //MessageBox.Show("复制成功!");
        }
Example #2
0
 private void dgvWinLog_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     //如果用户双击的是左上角的 “全选” 单元格,则全表复制。
     if (e.ColumnIndex == -1 && e.RowIndex == -1)
     {
         Clipboard.SetText(CopyAllList());
         AutoDelayCloseMessageBox.Show("成功把当前表格的全部内容复制到剪贴板中!", delayCloseMilliseconds);
         //MessageBox.Show("成功把当前表格的全部内容复制到剪贴板中!");
         return;
     }
     //如果双击的是某一行的头部 RowHeader 时,复制当前行整行的内容到剪贴板。
     if (e.ColumnIndex == -1)
     {
         Clipboard.SetText(CopyRow(e.RowIndex, true));
         AutoDelayCloseMessageBox.Show("成功把当前行的内容复制到剪贴板中!", delayCloseMilliseconds);
         //MessageBox.Show("成功把当前行的内容复制到剪贴板中!");
         return;
     }
     //如果双击的是某一列的头部 ColumnHeader 时,不作任何处理,直接返回。
     if (e.RowIndex == -1)
     {
         return;
     }
     if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
     {
         DataGridViewCell currentCell = this.dgvWinLog[e.ColumnIndex, e.RowIndex];
         if (e.ColumnIndex != this.dgvWinLog.Columns[COLUMN_PLANFORECAST_NAME].Index)
         {
             return;
         }
         //(this.dgvWinLog.Rows[e.RowIndex].Tag as List<string>)
         Clipboard.SetText(currentCell.Value.ToString());
         AutoDelayCloseMessageBox.Show("成功把当前单元格的内容复制到剪贴板中!", delayCloseMilliseconds);
         //MessageBox.Show("成功把当前单元格的内容复制到剪贴板中!");
     }
 }