Announcement

Collapse
No announcement yet.

Bild in PictureBox verkleinern

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bild in PictureBox verkleinern

    Hallo zusammen,

    ich möchte erreichen, dass ein Bild in einer PictureBox mit der Verkleinerung der PictureBox während des Programmablaufs ebenfalls verkleinert wird, also immer komplett sichtbar bleibt.

    Wie geht das??

    vG

    fredyx

  • #2
    Hallo,

    indem die SizeMode-Eigenschaft auf Zoom gestellt wird.

    ZB
    [highlight=vbnet]
    Imports System
    Imports System.Windows.Forms

    Namespace WindowsFormsApplication1
    Public Partial Class Form1
    Inherits Form
    Private _ratio As Single

    Public Sub New()
    InitializeComponent()

    pictureBox1.SizeMode = PictureBoxSizeMode.Zoom
    _ratio = pictureBox1.Height / pictureBox1.Width
    End Sub

    Private Sub trackBar1_Scroll(ByVal sender As Object, ByVal e As EventArgs)
    pictureBox1.Width = trackBar1.Value
    pictureBox1.Height = CInt((trackBar1.Value * _ratio))
    End Sub
    End Class
    End Namespace
    [/highlight]

    mfG Gü
    "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

    Comment


    • #3
      Danke, danke

      Comment

      Working...
      X