PDA

View Full Version : حرفه ای: جدا سازی تصاویر picturebox



www.pc3enter.tk
چهارشنبه 20 دی 1391, 13:12 عصر
سلام دوستان
من یک مشکلم داشتم
ان هم اینکه من در یک picturebox یک تصویر دارم و می خواهم در picturebox دیگری بخش کوچکی از تصویر را جدا کند و در picture2 نمایش دهد
باتشکر اگر من را راهنمایی کنید.

SlowCode
چهارشنبه 20 دی 1391, 15:27 عصر
سلام
با متد paintpicture می تونی این کار رو بکنی، توی نت مثال های زیادی واسش هست.

the king
چهارشنبه 20 دی 1391, 16:24 عصر
سلام دوستان
من یک مشکلم داشتم
ان هم اینکه من در یک picturebox یک تصویر دارم و می خواهم در picturebox دیگری بخش کوچکی از تصویر را جدا کند و در picture2 نمایش دهد
باتشکر اگر من را راهنمایی کنید.

به مثال پیوستی مراجعه کنید :
98125

www.pc3enter.tk
شنبه 23 دی 1391, 12:23 عصر
ممنون دوست عزیز

من کمی به مشکل برخوردم چون اصلا در این زمینه کار نکردم
اگر می شود اکمی در مورد این سورس توضیح دهید

Dim x As Integer, y As Integer
x = (HScroll1.Value Mod 4) * 78 + 5
y = (HScroll1.Value \ 4) * 78 + 5
Picture2.AutoRedraw = True
Picture2.ScaleMode = vbPixels
Picture2.PaintPicture Picture1.Picture, 0, 0, 70, 70, x, y, 70, 70, vbSrcCopy

و دیگر مزاهم وقت شما نمی شوم اگر لطف کنی در کارکردن با این کد چطور می توانم روی عکس ها کار کنم


ممنون می شوم اگر مرا راهنمایی کنید




http://uplod.ir/hvw1trqs0rfj/menu__ons.png.htm
http://uplod.ir/l50wl577lozv/telescope.bmp.htm

mehran901
شنبه 23 دی 1391, 14:22 عصر
گاهی وقت ها ی سرچ ساده خیلی موثر واقع میشه....
توضیحات کامل و نحوه استفاده از متد paintpicture

Draws the contents of a graphics file (.bmp, .wmf, .emf, .cur, .ico, or .dib) on a Form, PictureBox, or Printer. Doesn't support named arguments.

Syntax

object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

The PaintPicture method syntax has these parts:

Part Description
object Optional. An object expression that evaluates to an object in the Applies To list. If object is omitted, the Form object with the focus is assumed to be object.
Picture Required. The source of the graphic to be drawn onto object. Must be the Picture property of a Form or PictureBox.
x1, y1 Required. Single-precision values indicating the destination coordinates (x-axis and y-axis) on object for picture to be drawn. The ScaleMode property of object determines the unit of measure used.
Width1 Optional. Single-precision value indicating the destination width of picture. The ScaleMode property of object determines the unit of measure used. If the destination width is larger or smaller than the source width (width2), picture is stretched or compressed to fit. If omitted, the source width is used.
Height1 Optional. Single-precision value indicating the destination height of picture. The ScaleMode property of object determines the unit of measure used. If the destination height is larger or smaller than the source height (height2), picture is stretched or compressed to fit. If omitted, the source height is used.
x2, y2 Optional. Single-precision values indicating the coordinates (x-axis and y-axis) of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, 0 is assumed.
Width2 Optional. Single-precision value indicating the source width of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source width is used.
Height2 Optional. Single-precision value indicating the source height of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source height is used.
Opcode Optional. Long value or code that is used only with bitmaps. It defines a bit-wise operation (such as vbMergeCopy or vbSrcAnd) that is performed on picture as it's drawn on object. For a complete list of bit-wise operator constants, see the RasterOp Constants topic in Visual Basic Help.
There are some limitations in the usage of opcodes. For example, you can't use any opcode other than vbSrcCopy if the source is an icon or metafile, and the opcodes that interact with the pattern (or "brush" in SDK terms) such as MERGECOPY, PATCOPY, PATPAINT, and PATINVERT actually interact with the FillStyle property of the destination.

Note Opcode is used to pass a bitwise operation on a bitmap. Placing a value in this argument when passing other image types will cause an "Invalid procedure call or argument" error. This is by design. To avoid this error, leave the Opcode argument blank for any image other than a bitmap.