Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Windows Mobile Password Safe

, 12 Jan 2009
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 Fluid.Drawing.Runtime.InteropServices.ComTypes;
using Color = System.Drawing.Color;
using PixelFormat = System.Drawing.Imaging.PixelFormat;
using BitmapData = System.Drawing.Imaging.BitmapData;
using System.Drawing;

namespace Fluid.Drawing.GdiPlus
{
    public class BitmapPlus : ImagePlus
    {
        public BitmapPlus(string filename)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromFileICM(filename, out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }

        private void Initialize()
        {
            //    GdiPlusInitializer.Initialize();
        }


        public BitmapPlus(IStream stream)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromStreamICM(stream, out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }


        public BitmapPlus(int width, int height, int stride, PixelFormat format, IntPtr scan0)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromScan0(width,
                                                               height,
                                                               stride,
                                                               format,
                                                               scan0,
                                                               out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }


        public BitmapPlus(int width, int height, PixelFormat format)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromScan0(width,
                                                               height,
                                                               0,
                                                               format,
                                                               IntPtr.Zero,
                                                               out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }


        public BitmapPlus(int width, int height, GraphicsPlus target)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromGraphics(width,
                                                                  height,
                                                                  target.nativeGraphics,
                                                                  out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }

        public BitmapPlus(HBITMAP hbm, IntPtr hpal)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromHBITMAP(hbm, hpal, out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }

        public BitmapPlus(IntPtr hbitmap)
        {
            Initialize();
            IntPtr hpal = IntPtr.Zero;
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromHBITMAP(hbitmap, hpal, out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }




        public BitmapPlus FromFile(string filename)
        {
            return new BitmapPlus(filename);
        }


        public BitmapPlus FromStream(IStream stream)
        {
            return new BitmapPlus(stream);
        }



        public BitmapPlus FromHBITMAP(HBITMAP hbm, IntPtr hpal)
        {
            return new BitmapPlus(hbm, hpal);
        }



        public IntPtr GetHBITMAP(Color colorBackground)
        {

            HBITMAP hbmReturn;
            GpStatus status = GdiPlus.GdipCreateHBITMAPFromBitmap((GpBitmap)(IntPtr)nativeImage, out hbmReturn, colorBackground.ToArgb());
            SetStatus(status);
            return hbmReturn.val;
        }



        public BitmapPlus(GpBitmap nativeBitmap)
        {
            lastResult = GpStatus.Ok;

            SetNativeImage((IntPtr)nativeBitmap);
        }


        public void LockBits(Rectangle rect, uint flags, PixelFormat format, BitmapData lockedBitmapData)
        {
            SetStatus(GdiPlus.GdipBitmapLockBits(
                                            (GpBitmap)(IntPtr)nativeImage,
                                            rect,
                                            flags,
                                            format,
                                            lockedBitmapData));
        }


        public void UnlockBits(BitmapData lockedBitmapData)
        {
            SetStatus(GdiPlus.GdipBitmapUnlockBits(
                                            (GpBitmap)(IntPtr)nativeImage,
                                            lockedBitmapData));
        }


        public Color GetPixel(int x, int y)
        {
            int argb;
            SetStatus(GdiPlus.GdipBitmapGetPixel((GpBitmap)(IntPtr)nativeImage, x, y, out argb));

            return Color.FromArgb(argb);
        }


        public void SetPixel(int x, int y, Color color)
        {
            SetStatus(GdiPlus.GdipBitmapSetPixel((GpBitmap)(IntPtr)nativeImage, x, y, color.ToArgb()));
        }




    }
}

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140905.1 | Last Updated 12 Jan 2009
Article Copyright 2009 by Thomas Gerber
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid