Größe einer Picturebox zur Laufzeit ändern

PoNr

Mitglied
Hi,
hab wieder mal ein Problem, un dhoffe dass Ihr mir helfen könnt.
Ich würde gerne dem User die Möglichkeit geben, Picturebox und Label per "Anpacker"(Pfeile, die beim ziehen von Bildern angezeigt werden) zu verändern, also Höher oder Breiter zu machen.

Habe einen Quelltext gefunden wie ich dies mit einer Textbox mache, aber wie funktioniert es mit einem LAbel oder Picbox
Hat einer von euch eine Idee ?

Danke im Vorraus
PoNr
 
Versuch´s mal hiermit, bei einem Label funktioniert es nicht.
In Form:
Code:
Dim style As Long

Private Sub Form_Load()
 Dim SysMenuKillFlag As Integer
 
 initBoxStyle = GetWindowLong(Picture1.hWnd, GWL_STYLE)
 initLeft = Picture1.Left
 initTop = Picture1.Top
 initWidth = Picture1.Width
 initHeight = Picture1.Height
 SetControlStyle initBoxStyle, Picture1, Me.hWnd

 style = GetWindowLong(Picture1.hWnd, GWL_STYLE)
 style& = style& Or WS_THICKFRAME
 SetControlStyle initBoxStyle, Picture1, Me.hWnd

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 SetControlStyle initBoxStyle, Picture1, Me.hWnd
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 SetControlStyle style&, Picture1, Me.hWnd
End Sub
In Modul:
Code:
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H4
Public Const SWP_FLAGS = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME
Public Const GWL_STYLE = (-16)
Public Const WS_THICKFRAME = &H50000

Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Public Sub SetControlStyle(style&, X As Control, hWnd As Long)

 Dim r&

 If style& Then
  r& = SetWindowLong(X.hWnd, GWL_STYLE, style&)
  r& = SetWindowPos(X.hWnd, hWnd, 0, 0, 0, 0, SWP_FLAGS)
 End If

End Sub
 
Ok, danke
werde es morgen mal ausprobieren, aber neues Problem.
Ich kann per Drag & Drop Labels von einem Frame auf eine Picbox ziehen, allerdings gehören diese dann nicht zum Picboxinhalt, wie kriege ich es hin (ohne die LAbels, direkt in der IDe auf die Picbox zu legen) das sie zum Inhalt gehören
Ich würde gerne dann die picbox.image funktion benutzen, um eine Preview zu machen.

Habt ihr dafür auchne idee
Hab schon bei google geguckt, aber nichts gefunden.
 

Neue Beiträge

Zurück