Lebans Holdings 1999 Ltd.

 Home Up Feedback Contents Search What's New Files & Tips 

ImageClass
Home
Up
Select A Row
Magnify
LimitCharsMemo
RotateText
ImageClass
AutoSize TextBox
ZoomInOut
PaintProgram
FormatByCriteria
CmdButton
SetGetSB
Transparent
AnimatedGifPlayer
LoadJpegGif
ImageControlToClipBoard
CanGrow
LimitTextInput
AutoSizeFont
AnimateForm
AutoUpDown
MonthCalendar
AutoColumnWidth
RichText
SelectAlpha
FormDimensions
LoadSaveJpeg
TabColors
ToolTip
TextWidth-Height
MouseWheelOnOff
AlternateColorDetailSection
ConFormsCurControl
ConditionalFormatting
AutoSizeOLE
ChangeMDIBackGround
RecordNavigationButtons
HTMLEditor
CopyGetRTFfromClipboard
OpenForm
GradientFill

RETIRED! September 2009

I have officially retired from all things Access. Please do not send Email requesting support as I will not respond.

 

Keep all of your questions to the Newsgroups where everyone will benefit!

 

 

NEW VERSION for A97 - Updated Feb 24, 2002  PictureBoxA97.zip

I am Stupid!<grin> When I last updated the A97 version I mistakenly posted version 8 instead of version 25!!!!!!!!!!!!!. Here is the proper version to match the A2K release.

ImageClass has been replaced by the PictureBoxA97 project. A standard Image control is wrapped within a class to allow the control to resemble the standard Visual Basic PictureBox control. Simple drawing methods are directly supported as is Text output with rotation. A handle to a Device Context is exposed to allow the developer to use the full range of Graphic API's. Also supports Screen Grabs, Copy to Clipboard and Save Image control to a disk Bitmap file. Here is the Access 2000 version, PictureBoxA2K.zip

Bug Feb. 24/2002 Just noticed Bitmaps must not contain color tables. Will fix this in next release.

Bug Fix Oct.11 - It appears the Form was corrupt in the Oct 1 Update. I decompiled the project and everything seems fine now. Also the A97 version contains a PSet method not in the A2K version.

Version 3.5

Use NULL Pen when drawing Rectangles so no border is seen. A2K version only.

Version 3.2

Added support to flip Image Vertically and Horizontally with mirror option.

 

 

****OLDER FUNCTION ****   DO NOT USE. Left in for education purposed only!

NEW  ImageClassVer1.zip is a database containing a Class to partially mimic the functionality of a VB Standard PictureBox control. The Class is a wrapper for a standard Access Image control. The Class exposes a handle for a Device Context for use in API Graphics Library calls.

Allows for drawing/printing on your Form at Runtime!

**BUG ALERT - Nov.25,1999**

**RESOLVED**

Sigh, just when I start thinking how smart I am.I realize how stupid I can be. That's allright, I can take it! :-)
 
This is a wrapper for an Image Control in Access. Access exposes the DIB directly in a property. I am Drawing/Printing into the CreateDibSection and then copying this DIB data back to the Access Dib property.
 
The Image Control's underlying bitmap is 640*480 pixels. I originally sized the Image control, with Large Fonts enabled. So I am working at 120DPI. In order to display the entire Bitmap the Image control must be: 640pixels /120DPI = 5.33 inches wide
480pixels /120DPI = 4.0 inches high
 
Testing the control, everything displays perfectly at all resolutions.. until I decide to try it at work where my system is set to Small Fonts. Now it seems that the first 50 pixels or so are cut off of the left edge. My rantings in my original post showed that I spent enough time trying to debug this that I could have developed another wrapper from scratch!
 
OK  so Small Fonts means a display resolution of 96DPI.
640pixels /96DPI = 6.66 inches wide
480pixels /96DPI = 5.0 inches high
 
I finally figured this out because the Image control has has a property to specify the alignment of the internal Image. Center is the Default, I picked Upper Left Corner and everything finally showed up properly on the left edge of the control but was now cut off on the right edge. The little 5 watt light bulb went off in my head... and now I'm going to bed.
 
I hope these musings help the next poor soul...and I'm glad it won't be me!  :-)
 

 
Subject: Small Fonts DrawText CreateDibSection
Date: 1999/10/25
Author: Stephen Lebans <macarthuNoSpam@nbnet.nb.ca>
  Posting History Post Reply

Hi,
I'm getting a negative 50 pixel offset when I am Drawing or Printing onto my device Context with Small Fonts(96dpi) enabled. Under Large Fonts(120dpi) everything lines up perfectly. I've duplicated this on 2 machines with 95 and 98.
Here's the Logic I'm following.
 
 
'  Create Compatible Device Context
hdc = apiCreateCompatibleDC(0)
 
Creating a Bitmap
mBitmap = apiCreateDIBSection(hdc, lpBmih, DIB_RGB_COLORS, mBitMapAdd, 0&, 0&)
 
 
' Creating a Font
lngIC = apiCreateIC("DISPLAY", vbNullString, vbNullString, vbNullString)             'If the call to CreateIC didn't fail, then get the Screen X resolution.
            If lngIC <> 0 Then
                lngYdpi = apiGetDeviceCaps(lngIC, LOGPIXELSY)
                'Release the information context.
                apiDeleteDC (lngIC)
            Else
                ' Something has gone wrong. Assume an average value.                 lngYdpi = 120
            End
 
          myfont.lfHeight = (fontsize / 72) * -lngYdpi
          hFont = apiCreateFontIndirect(myfont)
 
 
' Print some text
        lpRect.Left = 5
          lpRect.right = lpBmih.bmiHeader.biWidth - lpRect.Left
        lpRect.top = 0
        Do While Ypos <= lpBmih.bmiHeader.biHeight
        lngRet = apiDrawText(mhDCImage, strOut, Len(strOut), lpRect, DT_LEFT )
        Ypos = Ypos + lngRet
        lpRect.top = Ypos
        Loop
 
 
 
I've checked the following.
1) My information context is correctly returning 96 or 120dpi.
2) I checked SetViewportOrgEx and SetWindowOrgEx and they are all 0's 3) I tried with no luck:
lngRet = apiSetTextAlign(mhDCImage, TA_LEFT Or TA_NOUPDATECP)
lngRet = apiMoveToEx(mhDCImage, 0, 0, pt)
4) My structure's BITMAPINFOHEADER and RECT's are all correct.
 
I've used the Text API's a lot and have not seen this problem
before..but I always develop in Large Fonts so I may have simply missed it.
 
Any advice would certainly be appreciated at this point in time. :-(
 
--
Stephen Lebans
macarthu@nbnet.nb.ca
http://www.lebans.com

 

 

 

 

 
 

May 23, 2004 Product Update
 
 
Rich Text ActiveX control. Version 1.8

Click Here!

 

Mar 15, 2005 Product Update
 
MouseHook  Replaces the MouseWheel DLL subclassing solution. Turns On/Off the MouseWheel with one line of code. No DLL registration required. Now supports Logitech mice!

Click Here! 

 

 

 
Back Home Up Next 
Stephen Lebans Copyright 2009

Last Modified : 09/11/09 12:03 AM