Gambas Documentation
Aperçu du Langage
À traduire
Code Snippets
Comment faire ...
Compilation et installation
Composants
gb
gb.args
gb.cairo
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.db
gb.db.form
gb.dbus
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.mdi
gb.gmp
gb.gsl
gb.gtk
gb.gtk3
gb.gui
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.libxml
gb.media
gb.mysql
gb.net
gb.net.curl
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.option
gb.pcre
gb.pdf
gb.qt4
.combobox.item
.container.children
.Menu.Children
.TabStripContainer
.TabStripContainer.Children
.TextArea.Selection
.TextBox.Selection
.Window.Controls
.Window.Menus
_ColumnView_Columns
_Draw_Clip
_Draw_Style
_GridView_Cell
_GridView_Column
_GridView_Columns
_GridView_Data
_GridView_Row
_GridView_Rows
_IconView_Item
_ListBox_Item
_TreeView
_TreeView_Item
Action
Align
Application
Arrange
Border
Button
CheckBox
Clipboard
Color
ColumnView
ComboBox
Container
Control
Cursor
Desktop
Dialog
Drag
Draw
DrawingArea
embedder
Fill
Font
Fonts
Form
Frame
GridView
HBox
HPanel
HSplit
IconView
Image
Key
Label
Line
ListBox
ListView
Menu
Message
Mouse
MovieBox
_new
Alignment
Border
Path
Playing
Rewind
Paint
PaintBrush
PaintExtents
PaintMatrix
Panel
Picture
PictureBox
Printer
ProgressBar
RadioButton
Rect
Screen
Screens
Scroll
ScrollArea
ScrollBar
ScrollView
Select
Separator
Slider
SpinBox
Style
SvgImage
TabStrip
TextArea
TextBox
TextLabel
ToggleButton
ToolButton
trayicon
trayicons
TreeView
UserContainer
UserControl
VBox
VPanel
VSplit
Watcher
Window
Windows
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt5
gb.qt5.opengl
gb.report
gb.scanner
gb.sdl
gb.sdl.sound
gb.settings
gb.signal
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Derniers changements
Dépôt d'applications
Documentation de l'Environnement de développement
Documentation des développeurs
Documents
Indenter
Index de tous les Documents
Index du langage
Lexique
LISEZ-MOI
Manuel du wiki
Messages d'erreur
Tutoriels
Wiki License

MovieBox.Mode (gb.qt4)

Property Mode As Integer

Return or set the picture display mode.

It is one of the following constants:

MovieBox.Normal The picture is displayed at it’s original size. No attempt is made to fit the picture to the size of the MovieBox.
MovieBox.Fill The picture is stretched to fit both the width and height of the MovieBox. Proportionality of the picture is not maintained.
MovieBox.Cover The picture proportionality is maintained. The entire MovieBox height and width is filled.
MovieBox.Contain The picture proportionality is maintained. The entire picture is displayed and stretched for best fit.
MovieBox.Repeat The picture is displayed at it’s original size and repeated. The entire MovieBox height and width is filled.

Example

' This demonstrates the PictureBox.Mode constants
' This code needs to be copied to a 'Graphical application'.

Private HBox1 As HBox
Private HBox2 As HBox
Private LabelMode As Label
Private PictureBox1 As PictureBox
Private SliderMode As Slider

Public Sub Form_Open()

  With Me
    .Height = 600
    .Width = 800
    .Arrangement = Arrange.Vertical
    .Padding = 5
  End With

  With HBox1 = New HBox(Me)
    .Height = 21
  End With

  With New Label(HBox1)
    .Expand = True
    .Height = 28
    .Text = "Move slider to change PictureBox Mode"
    .Font.Bold = True
  End With

  With LabelMode = New Label(HBox1)
    .Expand = True
    .Font.Bold = True
    .Alignment = Align.Right
  End With

  With HBox2 = New HBox(Me)
    .Height = 28
  End With

  With SliderMode = New Slider(HBox2) As "SliderMode"
    .MaxValue = 4
    .Mark = True
    .Width = 180
  End With

  If Not Exist("/tmp/test.png") Then
    Me.Show
    Me.Title = "Please wait downloading image...."
    Wait 0.5
    If Not Component.IsLoaded("gb.net.curl") Then Component.Load("gb.net.curl")
    File.save("/tmp/test.png", Object.New("HttpClient").Download("https://gambas.one/files/test.png"))
  End If

  With PictureBox1 = New PictureBox(Me)
    .Expand = True
    .Picture = Picture["/tmp/test.png"]
  End With

  SliderMode.Value = 4

End

Public Sub SliderMode_Change()

  Dim sText As String[] = ["Normal", "Fill", "Cover", "Contain", "Repeat"]

  PictureBox1.Mode = SliderMode.Value
  LabelMode.Text = "PictureBox1.Mode = PictureBox." & sText[SliderMode.Value]
  Me.Title = sText[SliderMode.Value]

End