/// -----------------------------------------------------------------------------------
        /// <summary>
        /// This will make sure an etched line is drawn above the OK and Help buttons.
        /// </summary>
        /// -----------------------------------------------------------------------------------
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            // Draw the etched, horizontal line separating the OK and Help buttons
            // from the rest of the form.
            LineDrawing.Draw(e.Graphics, 10, btnOK.Top - 10, this.ClientSize.Width - 20,
                             LineTypes.Etched);
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Draws the etched lines on the dialog.
        /// </summary>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            SizeF spaceSize = e.Graphics.MeasureString(@"m", Font);

            int x1 = m_lblProjectName.Right + (int)spaceSize.Width;
            int x2 = btnHelp.Right;
            int y  = (m_lblProjectName.Top + m_lblProjectName.Bottom) / 2;

            LineDrawing.Draw(e.Graphics, x1, y, x2, y);

            x1 = m_lblSpecifyWrtSys.Right + (int)spaceSize.Width;
            x2 = btnHelp.Right;
            y  = (m_lblSpecifyWrtSys.Top + m_lblSpecifyWrtSys.Bottom) / 2;

            LineDrawing.Draw(e.Graphics, x1, y, x2, y);
        }
Пример #3
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// -----------------------------------------------------------------------------------
        private void panSteps_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if (m_stepText == null)
            {
                return;
            }

            // This is the minimum height a single text line will occupy.
            // (Note: this doesn't include the spacing between lines.)
            int dyStepHeight = Math.Max(m_font.Height, kdypStepSquareHeight);

            // This is the rectangle for the text of step one. Each subsequent step's
            // text rectangle will be calculated by increasing the rectangle's Y
            // property accordingly. 3 is added as the number of horizontal pixels
            // between the text and the colored square.
            Rectangle rcText =
                new Rectangle(kdxpStepListSpacing + kdxpStepSquareWidth + 3,
                              kdypStepListSpacing,
                              panSteps.Width - (kdxpStepListSpacing + kdxpStepSquareWidth + 3),
                              dyStepHeight);

            // This is the distance between the top of a step text's rectangle
            // and the top of the colored square's rectangle. However, if the step
            // text's rectangle is shorter than the height of the square, the
            // padding will be zero.
            int dySquarePadding = (dyStepHeight > kdypStepSquareHeight) ?
                                  (dyStepHeight - kdypStepSquareHeight) / 2 : 0;

            // This is the rectangle for step one's colored square.
            Rectangle rcSquare = new Rectangle(kdxpStepListSpacing,
                                               kdypStepListSpacing + dySquarePadding,
                                               kdxpStepSquareWidth, kdypStepSquareHeight);

            StringFormat sf = new StringFormat(StringFormat.GenericTypographic);

            sf.Alignment     = StringAlignment.Near;
            sf.LineAlignment = StringAlignment.Center;
            sf.Trimming      = StringTrimming.EllipsisCharacter;

            // Calculate the horizontal position for the vertical connecting
            // line. (Subtracting 1 puts it just off center because the line
            // will be 2 pixels thick.)
            int xpConnectingLine = rcSquare.X + (kdxpStepSquareWidth / 2) - 1;

            // Create brushes for the colored squares and the step text.
            SolidBrush brSquare = new SolidBrush(kclrPendingStep);
            SolidBrush brText   = new SolidBrush(m_foreColor);

            for (int i = 0; i < m_stepText.Length; i++)
            {
                e.Graphics.DrawString(m_stepText[i], m_font, brText, rcText, sf);
                rcText.Y += dyStepHeight + kdypStepListSpacing;

                // Determine what color the square should be.
                if (i == m_stepText.Length - 1)
                {
                    brSquare.Color = kclrLastStep;
                }
                else if (i == m_currentStepNumber)
                {
                    brSquare.Color = kclrCurrentStep;
                }
                else if (i < m_currentStepNumber)
                {
                    brSquare.Color = kclrCompletedStep;
                }
                else
                {
                    brSquare.Color = kclrPendingStep;
                }

                // Draw the square next to the step text label.
                e.Graphics.FillRectangle(brSquare, rcSquare);
                rcSquare.Y += (dyStepHeight + kdypStepListSpacing);

                // Draw the vertical line connecting each step's square.
                if (i < m_stepText.Length - 1)
                {
                    LineDrawing line = new LineDrawing(e.Graphics);
                    line.LineType = LineTypes.Solid;

                    line.Draw(xpConnectingLine,
                              rcSquare.Y - kdypStepListSpacing,
                              xpConnectingLine, rcSquare.Y, kclrCompletedStep);

                    line.Draw(xpConnectingLine + 1,
                              rcSquare.Y - kdypStepListSpacing,
                              xpConnectingLine + 1, rcSquare.Y, kclrPendingStep);
                }
            }
        }