DEFINE CLASS form1 AS form DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT container1 AS container WITH ; Top = 44, ; Left = 100, ; Width = 137, ; Height = 130, ; Name = "Container1" ADD OBJECT form1.container1.image1 AS image WITH ; Picture = "c:\program files\microsoft visual foxpro 8\fox.bmp", ; Stretch = 1, ; Height = 33, ; Left = 8, ; Top = 8, ; Width = 32, ; Name = "Image1" PROCEDURE Resize thisform.refresh ENDPROC PROCEDURE container1.Refresh with this .Top = 0 .Left = 0 .Width = .Parent.Width .Height = .Parent.Height with .Image1 .Top = 1 .Left = 1 .Width = .Parent.Width - 2 .Height = .Parent.Height - 2 endwith endwith ENDPROC ENDDEFINETienes una imagen que se ajusta siempre al tamaño del form
PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form DoCreate = .T. Caption = "Form1" zoomfactor = 1 Name = "Form1" originalsize = .F. ADD OBJECT container1 AS container WITH ; Top = 30, ; Left = 87, ; Width = 208, ; Height = 184, ; MousePointer = 99, ; MouseIcon = "c:\program files\microsoft visual foxpro 8\graphics\cursors\magnify.cur", ; Name = "Container1" ADD OBJECT form1.container1.image1 AS image WITH ; Picture = "c:\program files\microsoft visual foxpro 8\fox.bmp", ; Stretch = 1, ; Height = 33, ; Left = 8, ; MousePointer = 99, ; MouseIcon = "c:\program files\microsoft visual foxpro 8\graphics\cursors\magnify.cur", ; Top = 8, ; Width = 32, ; Name = "Image1" ADD OBJECT label1 AS label WITH ; AutoSize = .T., ; Caption = "Zoom To", ; Height = 17, ; Left = 213, ; Top = 222, ; Width = 51, ; Name = "Label1" ADD OBJECT combo1 AS combobox WITH ; Height = 24, ; Left = 272, ; Style = 2, ; Top = 219, ; Width = 100, ; Name = "Combo1" ADD OBJECT text1 AS textbox WITH ; ControlSource = "thisform.zoomfactor", ; Enabled = .F., ; Height = 23, ; Left = 87, ; Top = 221, ; Width = 53, ; DisabledForeColor = RGB(0,0,255), ; Name = "Text1" ADD OBJECT label2 AS label WITH ; AutoSize = .T., ; Caption = "Zoom Factor", ; Height = 17, ; Left = 5, ; Top = 225, ; Width = 71, ; Name = "Label2" PROCEDURE Init thisform.OriginalSize = newobject('Empty') addproperty(thisform.OriginalSize, 'Width', thisform.container1.image1.width) addproperty(thisform.OriginalSize, 'Height', thisform.container1.image1.Height) bindevent(thisform.container1.image1, 'Click', thisform.container1, 'Click') bindevent(thisform.container1.image1, 'RightClick', thisform.container1, 'RightClick') ENDPROC PROCEDURE container1.RightClick thisform.ZoomFactor = thisform.ZoomFactor * 0.9 this.Refresh() ENDPROC PROCEDURE container1.Click thisform.ZoomFactor = thisform.ZoomFactor * 1.1 this.Refresh() ENDPROC PROCEDURE container1.Refresh with this.image1 .width = thisform.OriginalSize.width * thisform.zoomfactor .height = thisform.OriginalSize.height * thisform.zoomfactor .left = (this.width - .width) / 2 .top = (this.Height - .height) / 2 this.Parent.text1.Refresh() endwith ENDPROC PROCEDURE combo1.Init for i = 10 to 200 step 10 this.AddItem(alltrim(str(i))+'%') next i for i=250 to 1000 step 50 this.AddItem(alltrim(str(i))+'%') next i this.ListIndex=10 ENDPROC PROCEDURE combo1.InteractiveChange thisform.zoomfactor = val(this.Value)/100 thisform.Refresh() ENDPROC ENDDEFINEHTH