Click here to Skip to main content
11,634,631 members (68,407 online)
Click here to Skip to main content
Add your own
alternative version

Windows Mobile Password Safe

, 12 Jan 2009 CPOL 102.2K 2.6K 139
A password safe with a touch screen UI introducing Fluid Controls.
PasswordSafeExe.zip
Fluid.dll
passwords.pws
PasswordSafe.exe
PasswordSafeSource.zip
PasswordSafe
Fluditity
bin
Classes
vssver2.scc
Controls
enums
vssver2.scc
Events
vssver2.scc
Interfaces
vssver2.scc
vssver2.scc
Fluid.csproj.user
GdiPlus
mssccprj.scc
NativeMethods
vssver2.scc
vssver2.scc
Native
vssver2.scc
obj
Properties
vssver2.scc
vssver2.scc
PasswordSafe
bin
Release
Fluid.dll
passwords.pws
PasswordSafe.exe
Classes
vssver2.scc
Encryption
vssver2.scc
EventArgs
vssver2.scc
ListBoxes
vssver2.scc
PasswordSafe.csproj.user
Properties
vssver2.scc
Resources
lock.bmp
minus.png
props.bmp
save.bmp
saved.bmp
search.bmp
searchd.bmp
undo24.bmp
undo24_d.bmp
Untitled.png
vssver2.scc
security.ico
Templates
vssver2.scc
Themes
vssver2.scc
vssver2.scc
Xml
vssver2.scc
vssver2.scc
using System;

using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;
using System.ComponentModel;

namespace Fluid.Controls
{
#if false
    [Obsolete("Use FluidTextBox insteade.")]
    public class NativeFluidTextBox : FluidLabel
    {
        public NativeFluidTextBox(string text, int x, int y, int width, int height)
            : base(text, x, y, width, height)
        {
            BackColor = Color.White;
            ForeColor = SystemColors.ControlText;
            LineAlignment = StringAlignment.Center;
        }
        public override bool OnClick(PointEventArgs e)
        {
            base.OnClick(e);
            return true;
        }

        public override void OnPaint(FluidPaintEventArgs e)
        {
            base.OnPaint(e);
            if (showBorder)
            {
                using (Pen pen = new Pen(Color.Black))
                {
                    Rectangle bounds = e.ControlBounds;
                    bounds.Width--;
                    bounds.Height--;
                    e.Graphics.DrawRectangle(pen, bounds);
                }
            }
        }

        private TextBox box;

        private bool showBorder = true;

        [DefaultValue(true)]
        public bool ShowBorder
        {
            get { return showBorder; }
            set
            {
                if (showBorder != value)
                {
                    showBorder = value;
                    Invalidate();
                }
            }
        }

        /// <summary>
        /// When the control is entered and get the focus, a textbox window control is added to the 
        /// windows host control.
        /// </summary>
        public override void OnEnter(IHost host)
        {
            if (box == null)
            {
                box = new TextBox();
                box.Font = Font;
                box.BorderStyle = BorderStyle.None;
                box.TextChanged += new EventHandler(box_TextChanged);
                box.KeyDown += new KeyEventHandler(box_KeyDown);
                box.KeyPress += new KeyPressEventHandler(box_KeyPress);
                box.GotFocus += new EventHandler(box_GotFocus);
                box.LostFocus += new EventHandler(box_LostFocus);
                box.BackColor = BackColor;
            }
            Rectangle r = HostBounds;
            r.Inflate((int)(3 * -ScaleFactor.Width), (int)-ScaleFactor.Height);
            box.Text = Text;
            int dy = (r.Height - box.Height) / 2;
            r.Y += dy;
            box.Bounds = r;
            host.AddControl(box);
            box.Focus();
            Invalidate();
            base.OnEnter(host);
        }


        public void SelectAll()
        {
            if (box != null) box.SelectAll();
        }

        public void Select(int start, int length)
        {
            if (box != null) box.Select(start, length);
        }

        void box_LostFocus(object sender, EventArgs e)
        {
            PerformGotFocus();
        }

        void box_GotFocus(object sender, EventArgs e)
        {
            PerformLostFocus();
        }

        void box_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r') OnLostFocus();
        }

        void box_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                OnLostFocus();
            }
        }

        /// <summary>
        /// When the control leaves the focus, the windows textbox control is removed from the windows host control.
        /// </summary>
        public override void OnLeave(IHost host)
        {
            TextBox b = box;
            box = null;
            if (b != null)
            {
                Text = b.Text;
                b.Visible = false;
                host.RemoveControl(b);
                b.Dispose();
                Invalidate();
            }
            base.OnLeave(host);
        }

        void box_TextChanged(object sender, EventArgs e)
        {
            Text = box.Text;
        }

        public override bool Selectable { get { return true; } }

        protected override void OnTextChanged()
        {
            if (box != null) box.Text = Text;
            if (!Initializing)
            {
                if (TextChanged != null) TextChanged(this, EventArgs.Empty);
            }
            base.OnTextChanged();
        }

        /// <summary>
        /// Occurs when the text has changed.
        /// </summary>
        public event EventHandler TextChanged;


        public override bool Active { get { return true; } }

    }
#endif
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Thomas Gerber
Software Developer (Senior)
Germany Germany
MCPD
Enterprise Application Developer 3.5
Windows Developer 3.5
.ASP.NET Developer 3.5
.NET 2.0 Windows Developer
.NET 2.0 Web Developer
.NET 2.0 Enterprise Application Developer


MCTS
.NET 3.5 Windows Forms Applications
.NET 3.5 ASP.NET Applications
.NET 3.5, ADO.NET Application Development
.NET 3.5 WCF
.NET 3.5 WPF
.NET 3.5 WF
Microsoft SQL Server 2008, Database Development
.NET 2.0 Windows Applications
.NET 2.0 Web Applications
.NET 2.0 Distributed Applications
SQL Server 2005
Sharepoint Services 3.0 Application Development
Windows Vista Client Configuration

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150728.1 | Last Updated 12 Jan 2009
Article Copyright 2009 by Thomas Gerber
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid