vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
TOP-Angebot: 17 bzw. 24 Entwickler-Vollversionen zum unschlagbaren Preis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Ein- und Umsteiger
Re: ControlPaint (Rubberband) zeichnet an falscher Stelle 
Autor: Dideldum
Datum: 15.03.23 21:12

Fortsetzung:
           Case = 2 ' Zoom
                tsc_PicEditor_PictureBox.SizeMode = PictureBoxSizeMode.Zoom
                tmpString = "Anzeigegrösse (Verhältnis beibehalten)"
 
 
                tsc_PicEditor_PictureBox.Anchor = AnchorStyles.None
 
                Dim panelVerhältnis As Single = tsc_PicEditor_PictureBox.Width _
                  / tsc_PicEditor_PictureBox.Height
                Dim BildVerhältnis As Single = _
                tsc_PicEditor_PictureBox.Image.Width / _
                tsc_PicEditor_PictureBox.Image.Height
 
                If panelVerhältnis > 1 Then
                    ' Panel Breiter als Hoch
                    If BildVerhältnis > 1 Then
                        ' Bild Breiter als Hoch
                        If panelVerhältnis < BildVerhältnis Then
                            ' Bild schmaler als Panel
                            tsc_PicEditor_PictureBox.Width = _
                              tsc_PicEditor_Panel.Width
                            tsc_PicEditor_PictureBox.Height = _
                            tsc_PicEditor_Panel.Width / _
                            tsc_PicEditor_PictureBox.Image.Width * _
                            tsc_PicEditor_PictureBox.Image.Height
                            tsc_PicEditor_PictureBox.Top = ( _
                            tsc_PicEditor_Panel.Height - _
                            tsc_PicEditor_PictureBox.Height) / 2
                        Else
                            ' Bild breiter als Panel
                            tsc_PicEditor_PictureBox.Height = _
                              tsc_PicEditor_Panel.Height
                            tsc_PicEditor_PictureBox.Width = bildWidth / ( _
                            bildHeight / tsc_PicEditor_Panel.Height)
                            tsc_PicEditor_PictureBox.Left = ( _
                            tsc_PicEditor_Panel.Width - _
                            tsc_PicEditor_PictureBox.Width) / 2
                        End If
                    Else
                        tsc_PicEditor_PictureBox.Height = _
                          tsc_PicEditor_Panel.Height
                        tsc_PicEditor_PictureBox.Width = _
                        tsc_PicEditor_Panel.Height / _
                        tsc_PicEditor_PictureBox.Image.Height * _
                        tsc_PicEditor_PictureBox.Image.Width
                        tsc_PicEditor_PictureBox.Left = ( _
                        tsc_PicEditor_Panel.Width - _
                        tsc_PicEditor_PictureBox.Width) / 2
                    End If
                Else
                    If BildVerhältnis > 1 Then
                        tsc_PicEditor_PictureBox.Width = _
                          tsc_PicEditor_Panel.Width
                        tsc_PicEditor_PictureBox.Height = _
                        tsc_PicEditor_Panel.Width / _
                        tsc_PicEditor_PictureBox.Image.Width * _
                        tsc_PicEditor_PictureBox.Image.Height
                        tsc_PicEditor_PictureBox.Top = ( _
                        tsc_PicEditor_Panel.Height - _
                        tsc_PicEditor_PictureBox.Height) / 2
                    Else
                        If panelVerhältnis < BildVerhältnis Then
                            tsc_PicEditor_PictureBox.Width = _
                              tsc_PicEditor_Panel.Width
                            tsc_PicEditor_PictureBox.Height = _
                            tsc_PicEditor_Panel.Width / _
                            tsc_PicEditor_PictureBox.Image.Width * _
                            tsc_PicEditor_PictureBox.Image.Height
                            tsc_PicEditor_PictureBox.Top = ( _
                            tsc_PicEditor_Panel.Height - _
                            tsc_PicEditor_PictureBox.Height) / 2
                        Else
                            tsc_PicEditor_PictureBox.Height = _
                              tsc_PicEditor_Panel.Height
                            tsc_PicEditor_PictureBox.Width = _
                            tsc_PicEditor_Panel.Height / _
                            tsc_PicEditor_PictureBox.Image.Height * _
                            tsc_PicEditor_PictureBox.Image.Width
                            tsc_PicEditor_PictureBox.Left = ( _
                            tsc_PicEditor_Panel.Width - _
                            tsc_PicEditor_PictureBox.Width) / 2
                        End If
                    End If
                End If
 
            Case = 3 ' Stretch
                tsc_PicEditor_PictureBox.SizeMode = _
                  PictureBoxSizeMode.StretchImage
                tsc_PicEditor_PictureBox.Anchor = AnchorStyles.Top Or _
                AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right
 
                tmpString = "Anzeigegrösse (Verhältnis ignorieren)"
 
        End Select
 
        If tsc_PicEditor_PictureBox.Image IsNot Nothing Then
            dateiinfo = tmpString & " - (" & Format( _
              tsc_PicEditor_PictureBox.Image.PhysicalDimension.Width, _
              "###,###,##0") & " x " & Format( _
              tsc_PicEditor_PictureBox.Image.PhysicalDimension.Height, _
              "###,###,##0") & " - Format: " & Chr(34) & _
              tsc_PicEditor_PictureBox.Image.PixelFormat.ToString.Substring(6) _
              & Chr(34) & ")"
        Else
            dateiinfo = "Pic-Viewer"
        End If
    End Sub
Vielleicht hilft es ja

Beste Grüsse

Beitrag wurde zuletzt am 15.03.23 um 21:14:11 editiert.
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
ControlPaint (Rubberband) zeichnet an falscher Stelle279Bazi24.01.23 22:03
Re: ControlPaint (Rubberband) zeichnet an falscher Stelle94Dideldum15.03.23 21:12
Re: ControlPaint (Rubberband) zeichnet an falscher Stelle89Dideldum15.03.23 21:12
Re: ControlPaint (Rubberband) zeichnet an falscher Stelle86Dideldum16.03.23 14:59

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel