图片框中的缩放和缩略图vb.net [英] zoom and thumbnail in picturebox vb.net

查看:103
本文介绍了图片框中的缩放和缩略图vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我希望有人能帮助我

我使用vb.net 2012,我需要制作程序来查看图片并将其缩放到另一个图片框中

所以我的项目将包括1个按钮2个图片框

此按钮将打开文件对话框以选择图像并在picturebox1中查看,当我移动鼠标并在imagebox1中查看时选择图像中的点放大这一点,我是在图片框2中选择的

有什么帮助吗?

解决方案

H.S.A,

感谢您在MSDN论坛中发帖.

根据您的描述,您对此线程有三个问题.

  1. 使用按钮单击事件打开文件对话框以选择图像并在PictureBox1中查看.
  2. 单击鼠标并在PictureBox1中选择图像中的点时,它将获得图像的点放大/缩小.
  3. 在PictureBox2中显示缩放图片.

我尝试实现第一个功能,请参考以下代码片段:

私有子Button1_Click(作为对象发送,作为EventArgs发送)处理Button1.Click
        如果OpenFileDialog1.ShowDialog()= DialogResult.OK然后
            PictureBox1.Load(OpenFileDialog1.FileName)
        万一

        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    结束子

    私有子InitializePictureBoxAndButton()

        Me.Controls.Add(PictureBox1)
        Me.Controls.Add(Button1)
        Button1.Location =新点(175,20)
        Button1.Text ="Stretch"

        '设置PictureBox控件的大小.
        Me.PictureBox1.Size =新System.Drawing.Size(140,140)

        '将SizeMode设置为使图像居中.
        Me.PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage

        '将边框样式设置为三维边框.
        Me.PictureBox1.BorderStyle = BorderStyle.Fixed3D

        '设置图像属性.
        Me.PictureBox1.Image =新的位图(GetType(Button)," Button.bmp")
    结束

它只使用按钮单击事件打开文件对话框来选择图像并在PictureBox1中查看它.

接下来的功能是您可以参考下面的链接来实现它(此代码在C#中,但是每个转换器都可以将其转换为VB).

http://www.codeproject.com/Articles/21097/PictureBox-Zoom

希望对您有帮助.

最好的问候,

张娜达


hello i hope any one can help me so 

i use vb.net 2012 and i need make program to view picture and zoom it in another picture box

so my project will include 1 button 2 picture box

this button will open the file dialog to chooses  the image and view it in picturebox1 and when i move my mouse and select point in image this in viewed in picturebox1  zoom this point i was select in picturebox 2

any help please ?

解决方案

Hi H.S.A,

Thank you for posting in MSDN Forum.

Based on your description, you have the three problems about this thread.

  1. Use button click event to open the file dialog to choose the image and view it in PictureBox1.
  2. When you click mouse and select point in the image in PictureBox1, it will get the point of the picture zoom in/out.
  3. Show the zoom picture in PictureBox2.

I have tried to implement the first function, please refer the following code snippet:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            PictureBox1.Load(OpenFileDialog1.FileName)
        End If

        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    End Sub

    Private Sub InitializePictureBoxAndButton()

        Me.Controls.Add(PictureBox1)
        Me.Controls.Add(Button1)
        Button1.Location = New Point(175, 20)
        Button1.Text = "Stretch"

        ' Set the size of the PictureBox control.
        Me.PictureBox1.Size = New System.Drawing.Size(140, 140)

        'Set the SizeMode to center the image.
        Me.PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage

        ' Set the border style to a three-dimensional border.
        Me.PictureBox1.BorderStyle = BorderStyle.Fixed3D

        ' Set the image property.
        Me.PictureBox1.Image = New Bitmap(GetType(Button), "Button.bmp")
    End Sub

It just use button click event to open the file dialog to choose the image and view it in PictureBox1.

And the next function you could refer the following link to implement it (this code is in C# but every converter can be converted it to VB).

http://www.codeproject.com/Articles/21097/PictureBox-Zoom

Hope it will be helpful to you. 

Best Regards,

Neda Zhang


这篇关于图片框中的缩放和缩略图vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆