C
Ceefour
In case anyone is wondering...
(this is based on a conversation with "Juan C. Santaella"
I'm sharing here so anyone won't have to go through what I went through
again)
To display the DigitalPersona sample in a .NET Windows Forms PictureBox
:
Anyways, I found an alternative way that doesn't use
VisualBasic.Compatibility. It turns out the Picture is a standard
IPicture OLE object supported by the legacy Platform SDK. I can draw
the picture to anything in .NET that has a HDC handle. In this case I
use a .NET PictureBox to contain the picture :
private void axFPGetSampleX1_Done_1(object sender,
AxDPSDKOPSLib._IFPGetSampleXEvents_DoneEvent e)
{
IFPSample sample = (IFPSample)e.pSample;
IPicture picture = (IPicture)sample.Picture;
textBox1.Text = picture.Width.ToString() + "-" +
picture.Height.ToString();
using (Graphics graphics = pictureBox1.CreateGraphics())
{
IntPtr hDc = graphics.GetHdc();
picture.Render(hDc.ToInt32(), 0, 0, pictureBox1.Width,
pictureBox1.Height,
0, 0, picture.Width, picture.Height, IntPtr.Zero);
}
}
It worked for the moment. Maybe it's not very correct as it uses the
PictureBox's Graphics/DeviceContext instead of the Image's
(PictureBox.Image) Graphics/DeviceContext. But anyway it works so I
can save it to a GIF, BMP, JPEG, or save it to database if I want to.
And it works universally (meaning you can use it with C#, J#, or any
other .NET language). Not that you have to add a reference to stdole
COM library (that should be automatic). IPicture is contained in the
stdole namespace.
I'm not sure if you need any of this info. Maybe I'll post this
somewhere on google groups or forums so that more people will be able
to use DigitalPersona and not trying to bash their heads off in a
wall. (which may lead to more competition, but no good deed goes
unpunished).
(this is based on a conversation with "Juan C. Santaella"
I'm sharing here so anyone won't have to go through what I went through
again)
To display the DigitalPersona sample in a .NET Windows Forms PictureBox
:
Anyways, I found an alternative way that doesn't use
VisualBasic.Compatibility. It turns out the Picture is a standard
IPicture OLE object supported by the legacy Platform SDK. I can draw
the picture to anything in .NET that has a HDC handle. In this case I
use a .NET PictureBox to contain the picture :
private void axFPGetSampleX1_Done_1(object sender,
AxDPSDKOPSLib._IFPGetSampleXEvents_DoneEvent e)
{
IFPSample sample = (IFPSample)e.pSample;
IPicture picture = (IPicture)sample.Picture;
textBox1.Text = picture.Width.ToString() + "-" +
picture.Height.ToString();
using (Graphics graphics = pictureBox1.CreateGraphics())
{
IntPtr hDc = graphics.GetHdc();
picture.Render(hDc.ToInt32(), 0, 0, pictureBox1.Width,
pictureBox1.Height,
0, 0, picture.Width, picture.Height, IntPtr.Zero);
}
}
It worked for the moment. Maybe it's not very correct as it uses the
PictureBox's Graphics/DeviceContext instead of the Image's
(PictureBox.Image) Graphics/DeviceContext. But anyway it works so I
can save it to a GIF, BMP, JPEG, or save it to database if I want to.
And it works universally (meaning you can use it with C#, J#, or any
other .NET language). Not that you have to add a reference to stdole
COM library (that should be automatic). IPicture is contained in the
stdole namespace.
I'm not sure if you need any of this info. Maybe I'll post this
somewhere on google groups or forums so that more people will be able
to use DigitalPersona and not trying to bash their heads off in a
wall. (which may lead to more competition, but no good deed goes
unpunished).