There are many functions or methods in Bidisp DLL or OCX to easily display a loaded image.
[C++]
#include “BiDisp.h”
#include “BiTiff.h”
/* If you have a valid handle of a DIB to display, you can show the image on the
specified DC */
// Load the image into DIB
BOOL CMyDoc::LoadImage(const char *pszPathName, UINT nImage)
{
hDib = LoadTiffIntoDIB((LPSTR)pszPathName, nImage, FALSE);
if (hDib)
{
POSITION ps = GetFirstViewPosition();
RECT rOrigin;
SetRect(&rOrigin, 0, 0, 0, 0);
HWND hWnd = GetNextView(ps)->m_hWnd;
// sDisplay: DISPLAYSTRUCT (Display structure for paint, scroll)
// rScale: RECT (Rectangle for scaling the image on paint)
DisplayDIBStart(hWnd, hDib, &rOrigin, &rScale, DISP_SCALED |
DISP_NEWDIB, &sDisplay);
return TRUE;
}
return FALSE;
}
/* Redefine OnPaint function of the CView class */
void CMyView::OnPaint()
{
…
CPaintDC dc(this); // device context for painting
CMyDoc* pDoc = (CMyDoc*)GetDocument();
// The function displays the image passed as DIB onto the device content
DisplayDIBImageDC(dc.m_hDC, &pDoc->sDisplay);
}
[VB]
Sub LoadImage(fileName As String)
Dim BiTiffobj As Object
Dim hdib As Long
…
Set BiTiffobj = CreateObject("BITIFF.BITiffCtrl.1")
hdib = BiTiffobj.LoadTiffIntoDIB(fileName, 0, 0)
Set BiTiffobj = Nothing
…
If hdib > 0 Then
BiDisp.hdib = hdib
End If
End Sub
[C#]
private void LoadImage(string FileName)
{
int hDib;
…
hDib = BiTiff.LoadTiffIntoDIB(FileName, 0, false);
if (hDib > 0)
BiDisp.hDib = hDib;
}