示例#1
0
        // Initialize start of line drawing routine.
        public void StartLineDraw(Graphics grPad, Point ptStart)
        {
            // Set MousePressed flag to true at start of line drawing.
            f_bMousePressed = true;

            // Allocate temp working LineGraphic object.
            f_lgWorking = new LineGraphic();

            // Add starting point to temp object.
            f_lgWorking.AddPoint(ptStart);
        }
示例#2
0
        /* -------------------------------- PRIVATE UTILITY METHODS --------------------------------- */
        // Initialize Scratch Pad.
        private void InitScratchPad(Color clrCurrent, int nCurrentLineWidth)
        {
            // Allocate collection of LineGraphic objects.
            f_collLineGraphics = new List<LineGraphic>();

            // Temp working LineGraphic initially set to null.
            f_lgWorking = null;

            // MousePressed flag set to false (not pressed to start.)
            f_bMousePressed = false;

            // Allocate Pen object.
            f_penLine = new Pen(Color.Black);

            // Set current line color & width for future lines drawn.
            CurrentLineColor = clrCurrent;
            CurrentLineWidth = nCurrentLineWidth;

            // Set both start & end caps for line segments to rounded ends.
            f_penLine.StartCap = LineCap.Round;
            f_penLine.EndCap = LineCap.Round;
        }
示例#3
0
        // End line stroke procedure.
        public void EndLineDraw()
        {
            if ((f_bMousePressed == true) && (f_lgWorking != null))
            {
                // Store line color & width when object is committed.
                f_lgWorking.LineColor = CurrentLineColor;
                f_lgWorking.LineWidth = CurrentLineWidth;

                // Add Temp LineGraphic to LineGraphics collection.
                f_collLineGraphics.Add(f_lgWorking);

                // null temp object.
                f_lgWorking = null;

                // Reset MousePressed flag.
                f_bMousePressed = false;
            }
        }