Ejemplo n.º 1
0
        /// <summary>
        ///   Releases unmanaged and - optionally - managed resources
        /// </summary>
        ///
        /// <param name="disposing"><c>true</c> to release both managed
        /// and unmanaged resources; <c>false</c> to release only unmanaged
        /// resources.</param>
        ///
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free managed resources
                if (lastBitmap != null)
                {
                    lastBitmap.Dispose();
                    lastBitmap = null;
                }

                if (attributes != null)
                {
                    attributes.Dispose();
                    attributes = null;
                }

                if (context != null)
                {
                    context.Dispose();
                    context = null;
                }

                if (textFont != null)
                {
                    textFont.Dispose();
                    textFont = null;
                }

                if (textBrush != null)
                {
                    textBrush.Dispose();
                    textBrush = null;
                }

                if (backPen != null)
                {
                    backPen.Dispose();
                    backPen = null;
                }

                if (backBrush != null)
                {
                    backBrush.Dispose();
                    backBrush = null;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="CaptureKeyboard"/> class.
        /// </summary>
        ///
        public CaptureKeyboard()
        {
            context = new NativeKeyboardContext();
            conv    = new CustomKeysConverter();

            textFont            = new Font("Segoe UI", 20);
            currentTransparency = 0f;
            transparencyStep    = 0.3f;

            textBrush = new SolidBrush(Color.White);

            backPen   = new Pen(Color.White, 4f);
            backBrush = new SolidBrush(Color.DarkBlue);

            matrix          = new ColorMatrix();
            matrix.Matrix33 = currentTransparency;

            attributes = new ImageAttributes();

            location = new Point(5, 5);
        }