Esempio n. 1
0
 private void targetPivot_MouseMove(object sender, MouseEventArgs e)
 {
     if (!onDrag)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             PivotGridHitInfo hi = targetPivot.CalcHitInfo(e.Location);
             if (hi.HitTest == PivotGridHitTest.Value)
             {
                 if ((AllowDragRow && hi.ValueInfo.Field.Area == PivotArea.RowArea) || (AllowDragColumn && hi.ValueInfo.Field.Area == PivotArea.ColumnArea))
                 {
                     dragInfo = hi;
                     onDrag   = true;
                     targetPivot.FindForm().Cursor = Cursors.Hand;
                 }
             }
         }
     }
     else
     {
         DragDropEffects allowedEffect = GetDragEffect(e.Location);
         if (allowedEffect == DragDropEffects.None)
         {
             targetPivot.FindForm().Cursor = Cursors.No;
         }
         else
         {
             targetPivot.FindForm().Cursor = Cursors.Hand;
         }
     }
 }
Esempio n. 2
0
        static void DoExportEx(string title, string filter, string exportFormat, PivotGridControl grid)
        {
            if (grid == null)
            {
                return;
            }

            string fname = grid.FindForm().Text;

            fname = fname.Replace(" ", "");
            fname = fname.Replace('/', '_');
            //fname = FileUtility.GetValidateItemName(fname);
            fname = fname + "_" + DateTime.Now.ToString("yyyyMMddHHmmss");

            string fileName = ShowSaveFileDialog(title, filter, fname);

            if (string.IsNullOrEmpty(fileName) == false)
            {
                PivotGridExportHelper exporter = new PivotGridExportHelper();
                exporter.exportGrid = grid;
                exporter.stop       = false;
                exporter.thread     = new Thread(new ThreadStart(exporter.StartExport));
                exporter.thread.Start();
                Cursor currentCursor = Cursor.Current;
                Cursor.Current = Cursors.WaitCursor;

                switch (exportFormat)
                {
                case "htm": grid.ExportToHtml(fileName);
                    break;

                case "mht": grid.ExportToMht(fileName);
                    break;

                case "pdf": grid.ExportToPdf(fileName);
                    break;

                case "xls": grid.ExportToXls(fileName);
                    break;

                case "rtf": grid.ExportToRtf(fileName);
                    break;

                case "txt": grid.ExportToText(fileName, "\t");
                    break;
                }
                exporter.EndExport();
                Cursor.Current = currentCursor;
                OpenFile(fileName);
            }
        }