private void PrintDataDetailListWithTracks(PrintPageEventArgs e)
        {
            // Jetzt noch die Trackdaten
            CD cd;

            if (printType == PrintType.CurrentCD)
            {
                cd = this.cd;
            }
            else
            {
                cd = dataBase.GetCDById(CDView.GetCDID(currentPrintRecord));
            }

            // Maximale Länge der Feldnamen ermitteln
            foreach (Field field in detailListFields)
            {
                SizeF size = e.Graphics.MeasureString(dataBase.GetNameOfField(field) + ": ", Settings.Current.PrintDetailsFont);
                if (size.Width > detailListMaximumFieldWidth)
                {
                    detailListMaximumFieldWidth = size.Width;
                }
            }

            float y         = e.MarginBounds.Top + headerHeight;
            float yCover    = y;
            float xWidthMax = e.MarginBounds.Width;

            if (Settings.Current.PrintCDCover)
            {
                float coverWidth = (float)e.MarginBounds.Width / (float)100.0 * (float)Settings.Current.PrintCDCoverSize;

                float coverPos = e.MarginBounds.Left;
                if (Settings.Current.PrintCDCoverAlign == 1)
                {
                    coverPos = (float)e.MarginBounds.Left + (float)e.MarginBounds.Width / 2.0f - coverWidth / 2.0f;
                }
                if (Settings.Current.PrintCDCoverAlign == 2)
                {
                    coverPos = (float)e.MarginBounds.Left + (float)e.MarginBounds.Width - coverWidth;
                }

                try
                {
                    Image      img         = Image.FromFile(Misc.FindCover(cd.CDCoverFrontFilename));
                    float      coverHeight = coverWidth * (float)img.Width / (float)img.Height;
                    RectangleF rect        = new RectangleF(coverPos, y, coverWidth, coverHeight);
                    e.Graphics.DrawImage(img, rect);
                    yCover += coverHeight;

                    if (!Settings.Current.PrintTextUnderCDCover)
                    {
                        xWidthMax = coverPos - e.MarginBounds.Left;
                    }
                }
                catch
                {   // Ignorieren, wenn Cover nicht geladen werden kann.
                }

                if (Settings.Current.PrintTextUnderCDCover)
                {
                    y = yCover;
                }
            }

            for (int col = 0; col < detailListFields.Count; col++)
            {
                float x = e.MarginBounds.Left;

                string value;

                if (printType == PrintType.CurrentCD)
                {
                    value = this.cd.GetStringByField(dataBase, detailListFields[col]);
                }
                else
                {
                    value = CDView.GetRowStringValue(currentPrintRecord, detailListFields[col]);
                }

                if (!string.IsNullOrEmpty(value) || detailListPrintEmptyFields)
                {
                    string fieldName = dataBase.GetNameOfField(detailListFields[col]);
                    e.Graphics.DrawString(fieldName + ":", Settings.Current.PrintDetailsFont, detailBrush, new PointF(x, y));
                    x += detailListMaximumFieldWidth;
                    RectangleF   rect = new RectangleF(x, y, xWidthMax - detailListMaximumFieldWidth, Settings.Current.PrintDetailsFont.Height);
                    StringFormat sf   = new StringFormat();
                    sf.Trimming    = StringTrimming.EllipsisCharacter;
                    sf.FormatFlags = StringFormatFlags.NoWrap;
                    e.Graphics.DrawString(value, Settings.Current.PrintDetailsFont, detailBrush, rect, sf);

                    y += Settings.Current.PrintDetailsFont.Height;
                }
            }

            if (yCover > y && !Settings.Current.PrintTextUnderCDCover)
            {
                y = yCover;
            }

            y += Settings.Current.PrintDetailsFont.Height;

            // Header der Trackdaten
            float[] percentageWidthsHeader = trackDetailsListFields.GetPercentageWidths();

            float xpos = e.MarginBounds.Left;

            for (int col = 0; col < trackDetailsListFields.Count; col++)
            {
                string value = dataBase.GetNameOfField(trackDetailsListFields[col].Field);
//                SizeF size = e.Graphics.MeasureString(value, Settings.Current.PrintDetailsFont);

                StringFormat sf = new StringFormat();
                sf.Trimming    = StringTrimming.EllipsisCharacter;
                sf.FormatFlags = StringFormatFlags.NoWrap;
                int        colWidth = (int)((float)e.MarginBounds.Width / (float)100.0 * percentageWidthsHeader[col]);
                RectangleF rect     = new RectangleF(xpos, y, colWidth, Settings.Current.PrintDetailsFont.Height);

                e.Graphics.DrawString(value, Settings.Current.PrintDetailsFont, detailBrush, rect, sf);

                xpos += ((float)e.MarginBounds.Width / (float)100.0 * percentageWidthsHeader[col]);
            }

            y += (float)Settings.Current.PrintDetailsFont.Height * 1.1f;

            e.Graphics.DrawLine(new Pen(Color.Black, 1), e.MarginBounds.Left, y, e.MarginBounds.Left + e.MarginBounds.Width, y);
            y += Settings.Current.PrintDetailsFont.Height * 0.2f;

            for (int i = currentPrintTrackRecord; i < cd.Tracks.Count; i++)
            {
                if (y > e.MarginBounds.Bottom)
                {
                    if (printDocument.PrintController.IsPreview)
                    {
                        // Im Preview nur die ersten 10 Seiten anzeigen, dauert sonst eventuell zu lang.
                        if (currentPage >= 9)
                        {
                            break;
                        }
                    }

                    e.HasMorePages          = true;
                    currentPrintTrackRecord = i;
                    currentPage++;
                    return;
                }

                int x = e.MarginBounds.Left;

                float[] percentageWidths = trackDetailsListFields.GetPercentageWidths();

                for (int col = 0; col < trackDetailsListFields.Count; col++)
                {
                    string value = cd.GetTrackStringByField(i, trackDetailsListFields[col].Field);
                    if (value != null)
                    {
//                        SizeF size = e.Graphics.MeasureString(value, Settings.Current.PrintDetailsFont);

                        StringFormat sf = new StringFormat();
                        sf.Trimming    = StringTrimming.EllipsisCharacter;
                        sf.FormatFlags = StringFormatFlags.NoWrap;
                        int        colWidth = (int)((float)e.MarginBounds.Width / (float)100.0 * percentageWidthsHeader[col]);
                        RectangleF rect     = new RectangleF(x, y, colWidth, Settings.Current.PrintDetailsFont.Height);

                        e.Graphics.DrawString(value, Settings.Current.PrintDetailsFont, detailBrush, rect, sf);
                    }

                    x += (int)((float)e.MarginBounds.Width / (float)100.0 * percentageWidths[col]);
                }

                y += Settings.Current.PrintDetailsFont.Height;
            }

            currentPrintTrackRecord = 0;

            if (printType != PrintType.CurrentCD && currentPrintRecord < CDView.Rows.Count - 1)
            {
                if (printDocument.PrintController.IsPreview)
                {
                    // Im Preview nur die ersten 10 Seiten anzeigen, dauert sonst eventuell zu lang.
                    if (currentPage >= 9)
                    {
                        e.HasMorePages = false;
                        return;
                    }
                }

                e.HasMorePages = true;
                currentPrintRecord++;
                currentPage++;
                return;
            }

            e.HasMorePages = false;
        }
        private void TransferFields(FormProgress formProgress)
        {
            Field sourceField = ((ComboBoxItem)comboBoxSourceField.SelectedItem).Field;
            Field targetField = ((ComboBoxItem)comboBoxTargetField.SelectedItem).Field;

            CDQueryDataSet cdQuery = dataBase.ExecuteCDQuery();

            CDDataView CDView = new CDDataView(dataBase, cdQuery, condition, new SortFieldCollection(), new FieldCollection());

            int errorCount = 0;

            formProgress.ProgressBar.Maximum = CDView.Rows.Count;
            formProgress.ProgressBar.Value   = 0;

            for (int i = 0; i < CDView.Rows.Count; i++)
            {
                CD cd = dataBase.GetCDById(CDView.GetCDID(i));

                try
                {
                    if (FieldHelper.IsCDField(sourceField))
                    {
                        object o = cd.GetValueByField(sourceField);
                        cd.SetValueToField(targetField, o);

                        if (checkBoxMoveField.Checked)
                        {
                            Type fieldType = DataBase.GetTypeByField(sourceField);
                            if (fieldType == typeof(string))
                            {
                                cd.SetValueToField(sourceField, "");
                            }
                            else if (fieldType == typeof(int))
                            {
                                cd.SetValueToField(sourceField, 0);
                            }
                            else
                            {
                                cd.SetValueToField(sourceField, null);
                            }
                        }
                    }
                    else
                    {
                        for (int track = 0; track < cd.Tracks.Count; track++)
                        {
                            object o = cd.GetTrackValueByField(track, sourceField);

                            cd.SetTrackValueToField(track, targetField, o);

                            if (checkBoxMoveField.Checked)
                            {
                                Type fieldType = DataBase.GetTypeByField(sourceField);
                                if (fieldType == typeof(string))
                                {
                                    cd.SetTrackValueToField(track, sourceField, "");
                                }
                                else if (fieldType == typeof(int))
                                {
                                    cd.SetTrackValueToField(track, sourceField, 0);
                                }
                                else
                                {
                                    cd.SetTrackValueToField(track, sourceField, null);
                                }
                            }
                        }
                    }

                    cd.Save(dataBase);
                }
                catch (Exception e)
                {
                    errorCount++;
                }

                if (formProgress.Canceled)
                {
                    break;
                }

                formProgress.ProgressBar.Value++;
                Application.DoEvents();
            }

            if (errorCount > 0)
            {
                MessageBox.Show(string.Format(StringTable.TransferFieldsTotal, CDView.Rows.Count - errorCount, CDView.Rows.Count), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }