Visual Basic 6 Black Book:Working With Images
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Then we use the picture clip controls GraphicCell array to get the new image, placing that image in the picture controls Picture property:
Private Sub Command2_Click()
intImageIndex = intImageIndex + 1
If intImageIndex >= 3 Then intImageIndex = 0
Picture1.Picture = PictureClip1.GraphicCell(intImageIndex)
End Sub
Thats all we neednow the user can click the new button, Get Next Cell, to cycle through the images in the picture clip control, as shown in Figure 19.7. Our picture clip control example is a success.
Figure 19.7 Using rows and columns in a picture clip control to retrieve images.
The code for this example is located in the picclip folder on this books accompanying CD-ROM.
Flipping Images
You can gain a lot of control over how images are displayed by the PaintPicture method, which lets you flip, translate, or resize images:
object.PaintPicture picture, x1, y1, [width1, height1, [x2, y2, [width2, _
height2, [opcode]]]]
You can use this method to stretch or flip images in forms, picture boxes, and the Printer object. Heres what the arguments passed to PaintPicture mean:
pictureThe source of the graphic to be drawn onto the object; should be a Picture property.
x1, y1Single-precision values indicating the destination coordinates (x-axis and y-axis) on the object for the picture to be drawn. The ScaleMode property of the object determines the unit of measure used.
width1Single-precision value indicating the destination width of the picture. The ScaleMode property of the object determines the unit of measure used. If the destination width is larger or smaller than the source width (width2), the picture is stretched or compressed to fit. If omitted, the source width is used.
height1Single-precision value indicating the destination height of the picture. The ScaleMode property of the object determines the unit of measure used. If the destination height is larger or smaller than the source height (height2), the picture is stretched or compressed to fit. If omitted, the source height is used.
x2, y2Single-precision values indicating the coordinates (x-axis and y-axis) of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, 0 is assumed.
width2Single-precision value indicating the source width of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, the entire source width is used.
height2Single-precision value indicating the source height of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, the entire source height is used.
opcodeLong value or code that is used only with bitmaps. It defines a bit-wise operation (such as vbMergeCopy) that is performed on the picture as it is drawn on the object.
You can flip a bitmap horizontally or vertically by using negative values for the destination height (height1) and/or the destination width (width1). Lets see an example. Heres how we flip the image in the current form horizontally and display it in Picture2:
Private Sub Form_Load()
PaintPicture Picture, Picture1.ScaleWidth, 0, _
1 * ScaleWidth, ScaleHeight
End Sub
If we load the image we used in Figure 19.2 into a form and use the preceding code, well get the results you see in Figure 19.8. Now were flipping images.
Figure 19.8 Flipping an image in a form.
The code for this example appears in the imageflip folder on this books accompanying CD-ROM.
Stretching Images
The Aesthetic Design Department is calling. The image of the company founder youve put into your program looks fine, but why is it so small? Cant you enlarge it?
You can use the PaintPicture method to stretch images in forms, picture boxes, and the Printer object. Heres how that method works:
object.PaintPicture picture, x1, y1, [width1, height1, [x2, y2, [width2, _
height2, [opcode]]]]
Heres what the arguments passed to PaintPicture mean:
pictureThe source of the graphic to be drawn onto the object; should be a Picture property.
x1, y1Single-precision values indicating the destination coordinates (x-axis and y-axis) on the object for the picture to be drawn. The ScaleMode property of the object determines the unit of measure used.
width1Single-precision value indicating the destination width of the picture. The ScaleMode property of the object determines the unit of measure used. If the destination width is larger or smaller than the source width (width2), the picture is stretched or compressed to fit. If omitted, the source width is used.
height1Single-precision value indicating the destination height of the picture. The ScaleMode property of the object determines the unit of measure used. If the destination height is larger or smaller than the source height (height2), the picture is stretched or compressed to fit. If omitted, the source height is used.
x2, y2Single-precision values indicating the coordinates (x-axis and y-axis) of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, 0 is assumed.
width2Single-precision value indicating the source width of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, the entire source width is used.
height2Single-precision value indicating the source height of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, the entire source height is used.
opcodeLong value or code that is used only with bitmaps. It defines a bit-wise operation (such as vbMergeCopy) that is performed on the picture as it is drawn on the object.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
Nuestro Circulo 633 FINAL DE MAESTROS CIUDAD DE BILBAO633626 629rozporzadzenie ke 633 2010629 631KODA DRA 633633633,19,artykulwięcej podobnych podstron