Source code of file oscpmwin_v0.1.2.189/pimgzoom.pas from the
osCommerce Product Manager for Windows.


0000:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001:   osCommerce Product Manager for Windows (oscpmwin).
0002:   0003:   
0004:   You can contact Mario A. Valdez-Ramirez
0005:   by email at mario@mariovaldez.org or paper mail at
0006:   Olmos 809, San Nicolas, NL. 66495, Mexico.
0007:   
0008:   This program is free software; you can redistribute it and/or modify
0009:   it under the terms of the GNU General Public License as published by
0010:   the Free Software Foundation; either version 2 of the License, or (at
0011:   your option) any later version.
0012:   
0013:   This program is distributed in the hope that it will be useful, but
0014:   WITHOUT ANY WARRANTY; without even the implied warranty of
0015:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0016:   General Public License for more details.
0017:   
0018:   You should have received a copy of the GNU General Public License
0019:   along with this program; if not, write to the Free Software
0020:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021:   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0022:   unit pimgzoom;
0023:   
0024:   interface
0025:   
0026:   uses
0027:     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
0028:     Dialogs, ComCtrls, ExtCtrls;
0029:   
0030:   type
0031:     Topm_Form_ImageZoom = class(TForm)
0032:       opm_Image_ZoomImage: TImage;
0033:       procedure opm_Image_ZoomImageClick(Sender: TObject);
0034:       procedure FormShow(Sender: TObject);
0035:       procedure FormCreate(Sender: TObject);
0036:       procedure FormDeactivate(Sender: TObject);
0037:       procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
0038:       procedure FormHide(Sender: TObject);
0039:     private
0040:     public
0041:     end;
0042:   
0043:   var
0044:     opm_Form_ImageZoom: Topm_Form_ImageZoom;
0045:   
0046:   implementation
0047:   
0048:   uses gnugettext, pedit, main, oscpmdata, balloons, attention;
0049:   
0050:   {$R *.dfm}
0051:   
0052:   
0053:   
0054:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0055:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0056:   procedure Topm_Form_ImageZoom.opm_Image_ZoomImageClick(Sender: TObject);
0057:   begin
0058:     PRopm_Sound ('RestoreDown', opmG_UISilent);
0059:     opm_Form_ImageZoom.Close;
0060:   end;
0061:   
0062:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0063:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0064:   procedure Topm_Form_ImageZoom.FormShow(Sender: TObject);
0065:   VAR
0066:     MaxX, MaxY, WSizeX, WSizeY : LONGINT;
0067:   begin
0068:     MaxX := Screen.WorkAreaWidth;
0069:     MaxY := Screen.WorkAreaHeight;
0070:     WSizeX := (opm_Form_ImageZoom.Width - opm_Form_ImageZoom.ClientWidth) + opm_Image_ZoomImage.Picture.Width;
0071:     WSizeY := (opm_Form_ImageZoom.Height - opm_Form_ImageZoom.ClientHeight) + opm_Image_ZoomImage.Picture.Height;
0072:     IF (WSizeX > MaxX) THEN
0073:       BEGIN
0074:         opm_Form_ImageZoom.Width := MaxX;
0075:         HorzScrollBar.Range := opm_Image_ZoomImage.Picture.Width;
0076:         HorzScrollBar.Position := 0;
0077:       END
0078:     ELSE
0079:       BEGIN
0080:         opm_Form_ImageZoom.ClientWidth := opm_Image_ZoomImage.Picture.Width;
0081:         HorzScrollBar.Range := opm_Image_ZoomImage.Picture.Width;
0082:       END;
0083:     IF (WSizeY > MaxY) THEN
0084:       BEGIN
0085:         opm_Form_ImageZoom.Height := MaxY;
0086:         VertScrollBar.Range := opm_Image_ZoomImage.Picture.Height;
0087:         VertScrollBar.Position := 0;
0088:       END
0089:     ELSE
0090:       BEGIN
0091:         opm_Form_ImageZoom.ClientHeight := opm_Image_ZoomImage.Picture.Height;
0092:         VertScrollBar.Range := opm_Image_ZoomImage.Picture.Height;
0093:       END;
0094:     opm_Image_ZoomImage.Hint := opm_Image_ZoomImage.Hint + #13#10#13#10 + _('Click to close...');
0095:     opm_Form_ImageZoom.Top := ((MaxY - opm_Form_ImageZoom.Height) DIV 2);
0096:     opm_Form_ImageZoom.Left := ((MaxX - opm_Form_ImageZoom.Width) DIV 2);
0097:     PRopm_Sound ('RestoreUp', opmG_UISilent);
0098:   end;
0099:   
0100:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0101:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0102:   procedure Topm_Form_ImageZoom.FormCreate(Sender: TObject);
0103:   begin
0104:     opm_Image_ZoomImage.Cursor := crHandPoint;
0105:     TranslateComponent (self);
0106:   end;
0107:   
0108:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0109:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0110:   procedure Topm_Form_ImageZoom.FormDeactivate(Sender: TObject);
0111:   begin
0112:     PRopm_Sound ('RestoreDown', opmG_UISilent);
0113:     opm_Form_ImageZoom.Close;
0114:   end;
0115:   
0116:   
0117:   
0118:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0119:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0120:   procedure Topm_Form_ImageZoom.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
0121:   begin
0122:     CASE Key OF
0123:       VK_RETURN, VK_SPACE, VK_ESCAPE : opm_Form_ImageZoom.Close;
0124:       VK_LEFT : HorzScrollBar.Position := HorzScrollBar.Position - HorzScrollBar.Increment;
0125:       VK_RIGHT : HorzScrollBar.Position := HorzScrollBar.Position + HorzScrollBar.Increment;
0126:       VK_UP : VertScrollBar.Position := VertScrollBar.Position - VertScrollBar.Increment;
0127:       VK_DOWN : VertScrollBar.Position := VertScrollBar.Position + VertScrollBar.Increment;
0128:     END;
0129:   end;
0130:   
0131:   
0132:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0133:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0134:   procedure Topm_Form_ImageZoom.FormHide(Sender: TObject);
0135:   begin
0136:     opm_Image_ZoomImage.Picture := NIL;
0137:   end;
0138:   
0139:   end.
 
 
NA fum/lmd: 2007.07.15
Copyright ©1994-2017 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link