20 Temmuz 2009 Pazartesi

TMPRegionImage 3.0


Hilited:Integer currently hilited region (where the cursor is, painted by HilitedBitmap)TmpRegionImage was developed to be a TGraphicControl descendant. It displays a bitmap (like TImage) and contains a list of clickeable regions (e.g. like countries on a map). You can specify different bitmaps for normal, hilited and selected state of a region. The package contains an editor for creating lists of regions (rectangle, ellipse, polygon, fill, combinations). Also included are some utility functions (in rgnpkg.pas) to store/load normal, hilited and selected bitmap and region lists of a TmpRegionImage component in one single compressed file or resource.TmpRegionImage properties:NormalBitmap:TBitmap the bitmap to display HiliteBitmap:TBitmap the bitmap to display when the mouse cursor is over a clickeable region SelectedBitmap:TBitmap the currently selected region is painted by a part of this bitmap RegionCursor:TCursor this cursor is displayed when the mouse is over a clickeable region Regions:TStringList textual representation of all clickeable regions AutoSelect:Boolean if set to true, a region will be change its state to selected/not selected by clicking on it ItemIndex: Integer currently selected region (painted by SelectedBitmap) MultiSelect: Boolean decides whether more than one region can be selected at a time (by shift-clicking) Selected[Index:Integer]: Boolean decides whether a region is to be drawn in selected state HiliteCurrent:Boolean if set to true, a hilited region will be painted by HiliteBitmap Hilited:Integer currently hilited region (where the cursor is, painted by HilitedBitmap) SingleRegion[Index:Integer]:HRGN returns the windows HRGN object of the specified region CombinedRegion[Index:Integer]:HRGN returns the windows HRGN object of the xord combination of the specified region and all regions on top of it StrTag[Index:Integer]:string textual Tag property of each region (for user defined purposes, like descriptions...) TmpRegionImage events:type TRegionEvent = procedure(Sender: TObject; const AIndex: integer) of object;OnEnterRegion:TRegionEvent is triggered when the mouse moves over a region OnLeaveRegion:TRegionEvent is triggered when the mouse leaves a region OnSelectionChange:TNotifyEvent is triggered when the selection changed (e.g. when a different region has been clicked) TmpRegionImage methods:function RegionAtPos(X, Y: integer): integer get the region at the specified cursor position function RegionAtCursorPos: integer get the region at the current cursor position procedure OffsetRegion(Index, dX, dY: integer) change the position of a region function IndexOfStrTag(sName: string): integer find a region by StrTag value function RegionsCount: integer get the number of regions Utility functions in rgnpkg.pas:procedure LoadRegionImage(fObj: TmpRegionImage; sFile: TFileName) load the bitmaps and regions list of a TmpRegionImage component from a compressed package file procedure ResLoadRegionImage(fObj: TmpRegionImage; fInst: HInst; fRes: string; fType: PChar = RT_RCDATA) load the bitmaps and regions list of a TmpRegionImage component from a compressed package in a resource procedure SaveRegionImage(fObj: TmpRegionImage; sFile: TFileName) save the bitmaps and regions list of a TmpRegionImage component to a compressed package fileIt displays a bitmap and contains a list of clickeable regions