//============================================================================*
        // cTargetPrintPreviewDialog() - Constructor
        //============================================================================*

        public cTargetPrintPreviewDialog(cDataFiles DataFiles, cTarget Target, Image TargetImage)
        {
            m_DataFiles = DataFiles;
            m_Target    = Target;
            m_Image     = TargetImage;

            if (m_DataFiles.Preferences.TargetPrintMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                WindowState = FormWindowState.Normal;

                Location   = m_DataFiles.Preferences.TargetPrintLocation;
                ClientSize = m_DataFiles.Preferences.TargetPrintSize;
            }

            Text = String.Format("{0} Target Calculator - Print Preview", Application.ProductName);

            PrintDocument TargetPrintDocument = new PrintDocument();

            TargetPrintDocument.PrintPage += OnPrintPage;

            Document = TargetPrintDocument;

            UseAntiAlias = true;

            m_fInitialized = true;
        }
        //============================================================================*
        // cTargetCalibrationForm() - Constructor
        //============================================================================*

        public cTargetCalibrationForm(cDataFiles DataFiles, cTarget Target)
        {
            InitializeComponent();

            m_DataFiles = DataFiles;
            m_Target    = Target;

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            CalibrationLengthTextBox.TextChanged += OnLengthChanged;

            //----------------------------------------------------------------------------*
            // Input Parameters
            //----------------------------------------------------------------------------*

            cDataFiles.SetInputParameters(CalibrationLengthTextBox, cDataFiles.eDataType.GroupSize);
            CalibrationLengthTextBox.MinValue = m_Target.MinCalibrationLength;

            //----------------------------------------------------------------------------*
            // Populate Form
            //----------------------------------------------------------------------------*

            CalibrationLengthTextBox.Value = cDataFiles.StandardToMetric(m_Target.CalibrationLength, cDataFiles.eDataType.GroupSize);
            cDataFiles.SetMetricLabel(LengthMeasurementLabel, cDataFiles.eDataType.GroupSize);

            SetDPILabel();

            UpdateButtons();
        }
        //============================================================================*
        // cTargetDetailsForm() - Constructor
        //============================================================================*

        public cTargetDetailsForm(cDataFiles DataFiles, cTarget Target)
        {
            InitializeComponent();

            m_DataFiles = DataFiles;
            m_Target    = new cTarget(Target);

            if (m_Target.BatchID != 0)
            {
                m_Batch = m_DataFiles.GetBatchByID(m_Target.BatchID);
            }

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            DatePicker.ValueChanged     += OnDateChanged;
            ShooterTextBox.TextChanged  += OnShooterChanged;
            LocationTextBox.TextChanged += OnLocationChanged;
            EventTextBox.TextChanged    += OnEventChanged;
            NotesTextBox.TextChanged    += OnNotesChanged;

            FirearmCombo.SelectedIndexChanged += OnFirearmChanged;

            //----------------------------------------------------------------------------*
            // Size Dialog and create Sho tList View
            //----------------------------------------------------------------------------*

            SetClientSizeCore(GeneralGroupBox.Location.X + GeneralGroupBox.Width + 10, OKButton.Location.Y + OKButton.Height + 20);

            m_ShotListView = new cTargetShotListView(m_DataFiles, m_Target);

            m_ShotListView.Location = new Point(6, 25);
            m_ShotListView.Size     = new Size(ShotDataGroupBox.Width - 12, ShotDataGroupBox.Height - 31);

            m_ShotListView.TabIndex = 0;

            ShotDataGroupBox.Controls.Add(m_ShotListView);

            //----------------------------------------------------------------------------*
            // Populate Data
            //----------------------------------------------------------------------------*

            PopulateFirearmCombo();

            PopulateDetailData();

            //----------------------------------------------------------------------------*
            // Finish up and exit
            //----------------------------------------------------------------------------*

            m_fInitialized = true;

            UpdateButtons();
        }
        //============================================================================*
        // cTargetPreferencesForm()
        //============================================================================*

        public cTargetPreferencesForm(cDataFiles DataFiles, cTarget Target, cTargetCalculatorForm TargetForm)
        {
            InitializeComponent();

            m_DataFiles  = DataFiles;
            m_Target     = Target;
            m_TargetForm = TargetForm;

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            AimPointColorButton.Click        += OnColorButtonClicked;
            OffsetColorButton.Click          += OnColorButtonClicked;
            ShotColorButton.Click            += OnColorButtonClicked;
            ShotForecolorButton.Click        += OnColorButtonClicked;
            ReticleColorButton.Click         += OnColorButtonClicked;
            CalibrationForecolorButton.Click += OnColorButtonClicked;
            CalibrationBackcolorButton.Click += OnColorButtonClicked;
            ExtremesColorButton.Click        += OnColorButtonClicked;
            GroupBoxColorButton.Click        += OnColorButtonClicked;

            ResetButton.Click += OnResetDefaultsClicked;

            SetClientSizeCore(ColorsGroupBox.Location.X + ColorsGroupBox.Width + 10, CloseButton.Location.Y + CloseButton.Height + 20);

            //----------------------------------------------------------------------------*
            // Populate Colors
            //----------------------------------------------------------------------------*

            AimPointColorButton.BackColor        = m_Target.AimPointColor;
            OffsetColorButton.BackColor          = m_Target.OffsetColor;
            ShotColorButton.BackColor            = m_Target.ShotColor;
            ShotColorButton.ForeColor            = m_Target.ShotForecolor;
            ShotForecolorButton.BackColor        = m_Target.ShotForecolor;
            ReticleColorButton.BackColor         = m_Target.ReticleColor;
            CalibrationForecolorButton.BackColor = m_Target.ScaleForecolor;
            CalibrationBackcolorButton.BackColor = m_Target.ScaleBackcolor;
            ExtremesColorButton.BackColor        = m_Target.ExtremesColor;
            GroupBoxColorButton.BackColor        = m_Target.GroupBoxColor;

            CalibrationBackcolorButton.ForeColor = m_Target.ScaleForecolor;
        }
Beispiel #5
0
        //============================================================================*
        // cTarget() - Copy Constructor
        //============================================================================*

        public cTarget(cTarget Target)
        {
            m_nBatchID = Target.m_nBatchID;
            m_dRange   = Target.m_dRange;

            m_nRotation       = Target.m_nRotation;
            m_dBulletDiameter = Target.m_dBulletDiameter;
            m_Caliber         = Target.m_Caliber;

            m_dCalibrationLength = Target.m_dCalibrationLength;
            m_CalibrationStart   = new Point(Target.m_CalibrationStart.X, Target.m_CalibrationStart.Y);
            m_CalibrationEnd     = new Point(Target.m_CalibrationEnd.X, Target.m_CalibrationEnd.Y);

            m_dGroupSize = Target.m_dGroupSize;

            if (Target.m_TargetImage != null)
            {
                m_TargetImage = new Bitmap(Target.m_TargetImage);
            }

            m_AimPoint = new Point(Target.m_AimPoint.X, Target.m_AimPoint.Y);

            m_ShotList = new List <Point>(Target.m_ShotList);

            m_Date        = Target.m_Date;
            m_strShooter  = Target.m_strShooter;
            m_strLocation = Target.m_strLocation;
            m_strEvent    = Target.m_strEvent;
            m_strNotes    = Target.m_strNotes;
            m_Firearm     = Target.Firearm;

            m_AimPointColor  = Target.m_AimPointColor;
            m_OffsetColor    = Target.m_OffsetColor;
            m_ShotColor      = Target.m_ShotColor;
            m_ShotForecolor  = Target.m_ShotForecolor;
            m_ReticleColor   = Target.m_ReticleColor;
            m_ScaleForecolor = Target.m_ScaleForecolor;
            m_ScaleBackcolor = Target.m_ScaleBackcolor;
            m_ExtremesColor  = Target.m_ExtremesColor;
            m_GroupBoxColor  = Target.m_GroupBoxColor;
        }
        //============================================================================*
        // cTargetShotListView() - Constructor
        //============================================================================*

        public cTargetShotListView(cDataFiles DataFiles, cTarget Target)
            : base(DataFiles, cPreferences.eApplicationListView.AmmoTestListView)
        {
            m_DataFiles = DataFiles;
            m_Target    = Target;

            //----------------------------------------------------------------------------*
            // Set Properties
            //----------------------------------------------------------------------------*

            Font = new System.Drawing.Font(Font, System.Drawing.FontStyle.Bold);

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            //----------------------------------------------------------------------------*
            // Populate Columns and Groups
            //----------------------------------------------------------------------------*

            SortingOrder = m_DataFiles.Preferences.AmmoTestSortOrder;

            SortingColumn = m_DataFiles.Preferences.AmmoTestSortColumn;

            m_arColumns[2].Text += String.Format(" ({0})", cDataFiles.MetricString(cDataFiles.eDataType.GroupSize));

            PopulateColumns(m_arColumns);

            //----------------------------------------------------------------------------*
            // Populate Data
            //----------------------------------------------------------------------------*

            Populate();

            Initialized = true;
        }