juniorcyber Postado Maio 4, 2008 Denunciar Share Postado Maio 4, 2008 (editado) Olahh pessoal!!Eu baixei um projeto de um editor de imgagem bem simples q eu quero acrescentar em meu projeto!eu queria q a seleção dele fike sempre na proporção bloqueada(Tipo "Aspect Ratio")O comando q eu uso pra chamar a caixa de seleção é:"ShowGrip True""lblShape" é a caixa de seleção (Label)__________________________________________________________________Private Sub ShowGrip(bShow As Boolean) Dim i As Integer lblShape.Move 100, 100, 2000, 2000 lblShape.Visible = bShow For i = 0 To 7 lblGrip(i).Visible = bShow Next i MoveGrips2 'SetSelection bShowEnd Sub'=============Sizing grip staff==============Private Sub InitGrip() Dim i As Integer lblGrip(0).Width = GripSize lblGrip(0).Height = GripSize For i = 1 To 7 Load lblGrip(i) lblGrip(i).MousePointer = i + 4 * Int((9 - i) / 4) Next i lblGrip(0).MousePointer = 8 ShowGrip FalseEnd SubPrivate Sub lblGrip_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbLeftButton Then bSizing = True xStart = x: yStart = y lblShape.Enabled = False End IfEnd SubPrivate Sub lblGrip_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) Dim lft As Long, tp As Long, wdt As Long, hgt As Long If bSizing Then Select Case Index Case 0 lft = lblShape.Left + x - xStart tp = lblShape.Top + y - yStart wdt = lblShape.Width - x + xStart hgt = lblShape.Height - y + yStart Case 1 lft = lblShape.Left + x - xStart tp = lblShape.Top wdt = lblShape.Width - x + xStart hgt = lblShape.Height Case 2 lft = lblShape.Left + x - xStart tp = lblShape.Top wdt = lblShape.Width - x + xStart hgt = lblShape.Height + y - yStart Case 3 lft = lblShape.Left tp = lblShape.Top wdt = lblShape.Width hgt = lblShape.Height + y - yStart Case 4 lft = lblShape.Left tp = lblShape.Top wdt = lblShape.Width + x - xStart hgt = lblShape.Height + y - yStart Case 5 lft = lblShape.Left tp = lblShape.Top wdt = lblShape.Width + x - xStart hgt = lblShape.Height Case 6 lft = lblShape.Left tp = lblShape.Top + y - yStart wdt = lblShape.Width + x - xStart hgt = lblShape.Height - y + yStart Case 7 lft = lblShape.Left tp = lblShape.Top + y - yStart wdt = lblShape.Width hgt = lblShape.Height - y + yStart End Select If wdt < 0 Or hgt < 0 Or lft < 0 Or tp < 0 Or lft + wdt > picImage.Width Or tp + hgt > picImage.Height Then Exit Sub lblShape.Move lft, tp, wdt, hgt MoveGrips End IfEnd SubPrivate Sub lblGrip_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) bSizing = False lblShape.Enabled = True' SetSelection TrueEnd SubPrivate Sub lblShape_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbLeftButton Then bMoving = True xStart = x: yStart = y lblShape.MousePointer = 5 ElseIf Button = vbRightButton Then UpdateEditMenu PopupMenu mnuEdit ElseIf Button = vbMiddleButton Then UpdateImageMenu PopupMenu mnuImage End IfEnd SubPrivate Sub lblShape_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) Dim lft As Long, tp As Long If bMoving Then lft = lblShape.Left + x - xStart tp = lblShape.Top + y - yStart If lft <= 0 Then lft = 0 If tp <= 0 Then tp = 0 If lft > picImage.Width - lblShape.Width Then lft = picImage.Width - lblShape.Width If tp > picImage.Height - lblShape.Height Then tp = picImage.Height - lblShape.Height lblShape.Move lft, tp MoveGrips End IfEnd SubPrivate Sub lblShape_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) bMoving = False lblShape.MousePointer = 0' SetSelection TrueEnd SubPrivate Sub MoveGrips2() XGrip(0) = lblShape.Left - GripSize XGrip(1) = lblShape.Left + lblShape.Width / 2 - GripSize / 2 XGrip(2) = lblShape.Left + lblShape.Width YGrip(0) = lblShape.Top - GripSize YGrip(1) = lblShape.Top + lblShape.Height / 2 - GripSize / 2 YGrip(2) = lblShape.Top + lblShape.Height lblGrip(0).Move XGrip(0), YGrip(0) lblGrip(1).Move XGrip(0), YGrip(1) lblGrip(2).Move XGrip(0), YGrip(2) lblGrip(3).Move XGrip(1), YGrip(2) lblGrip(4).Move XGrip(2), YGrip(2) lblGrip(5).Move XGrip(2), YGrip(1) lblGrip(6).Move XGrip(2), YGrip(0) lblGrip(7).Move XGrip(1), YGrip(0)End Sub_____________________________________________________________to até com dor de cabeça tentando achar uma forma de fazer isso!! rsse alguém tiver uma dica aihh por favor me ajude!! em quanto isso eu vo tentando sozinho!! valeu!!!!! Editado Maio 9, 2008 por juniorcyber Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 juniorcyber Postado Maio 4, 2008 Autor Denunciar Share Postado Maio 4, 2008 (editado) . Editado Maio 8, 2008 por juniorcyber Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 juniorcyber Postado Maio 9, 2008 Autor Denunciar Share Postado Maio 9, 2008 Alquem saberia me dar pelo menos um rumo de onde eu deveria mecher?? se alguém tiver alguma noção disso e puder me ajudar eu agradeceria muiiito!! rsFalowww!! Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
juniorcyber
Olahh pessoal!!
Eu baixei um projeto de um editor de imgagem bem simples q eu quero acrescentar em meu projeto!
eu queria q a seleção dele fike sempre na proporção bloqueada(Tipo "Aspect Ratio")
O comando q eu uso pra chamar a caixa de seleção é:
"ShowGrip True"
"lblShape" é a caixa de seleção (Label)
__________________________________________________________________
Private Sub ShowGrip(bShow As Boolean)
Dim i As Integer
lblShape.Move 100, 100, 2000, 2000
lblShape.Visible = bShow
For i = 0 To 7
lblGrip(i).Visible = bShow
Next i
MoveGrips2
'SetSelection bShow
End Sub
'=============Sizing grip staff==============
Private Sub InitGrip()
Dim i As Integer
lblGrip(0).Width = GripSize
lblGrip(0).Height = GripSize
For i = 1 To 7
Load lblGrip(i)
lblGrip(i).MousePointer = i + 4 * Int((9 - i) / 4)
Next i
lblGrip(0).MousePointer = 8
ShowGrip False
End Sub
Private Sub lblGrip_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
bSizing = True
xStart = x: yStart = y
lblShape.Enabled = False
End If
End Sub
Private Sub lblGrip_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lft As Long, tp As Long, wdt As Long, hgt As Long
If bSizing Then
Select Case Index
Case 0
lft = lblShape.Left + x - xStart
tp = lblShape.Top + y - yStart
wdt = lblShape.Width - x + xStart
hgt = lblShape.Height - y + yStart
Case 1
lft = lblShape.Left + x - xStart
tp = lblShape.Top
wdt = lblShape.Width - x + xStart
hgt = lblShape.Height
Case 2
lft = lblShape.Left + x - xStart
tp = lblShape.Top
wdt = lblShape.Width - x + xStart
hgt = lblShape.Height + y - yStart
Case 3
lft = lblShape.Left
tp = lblShape.Top
wdt = lblShape.Width
hgt = lblShape.Height + y - yStart
Case 4
lft = lblShape.Left
tp = lblShape.Top
wdt = lblShape.Width + x - xStart
hgt = lblShape.Height + y - yStart
Case 5
lft = lblShape.Left
tp = lblShape.Top
wdt = lblShape.Width + x - xStart
hgt = lblShape.Height
Case 6
lft = lblShape.Left
tp = lblShape.Top + y - yStart
wdt = lblShape.Width + x - xStart
hgt = lblShape.Height - y + yStart
Case 7
lft = lblShape.Left
tp = lblShape.Top + y - yStart
wdt = lblShape.Width
hgt = lblShape.Height - y + yStart
End Select
If wdt < 0 Or hgt < 0 Or lft < 0 Or tp < 0 Or lft + wdt > picImage.Width Or tp + hgt > picImage.Height Then Exit Sub
lblShape.Move lft, tp, wdt, hgt
MoveGrips
End If
End Sub
Private Sub lblGrip_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
bSizing = False
lblShape.Enabled = True
' SetSelection True
End Sub
Private Sub lblShape_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
bMoving = True
xStart = x: yStart = y
lblShape.MousePointer = 5
ElseIf Button = vbRightButton Then
UpdateEditMenu
PopupMenu mnuEdit
ElseIf Button = vbMiddleButton Then
UpdateImageMenu
PopupMenu mnuImage
End If
End Sub
Private Sub lblShape_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lft As Long, tp As Long
If bMoving Then
lft = lblShape.Left + x - xStart
tp = lblShape.Top + y - yStart
If lft <= 0 Then lft = 0
If tp <= 0 Then tp = 0
If lft > picImage.Width - lblShape.Width Then lft = picImage.Width - lblShape.Width
If tp > picImage.Height - lblShape.Height Then tp = picImage.Height - lblShape.Height
lblShape.Move lft, tp
MoveGrips
End If
End Sub
Private Sub lblShape_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
bMoving = False
lblShape.MousePointer = 0
' SetSelection True
End Sub
Private Sub MoveGrips2()
XGrip(0) = lblShape.Left - GripSize
XGrip(1) = lblShape.Left + lblShape.Width / 2 - GripSize / 2
XGrip(2) = lblShape.Left + lblShape.Width
YGrip(0) = lblShape.Top - GripSize
YGrip(1) = lblShape.Top + lblShape.Height / 2 - GripSize / 2
YGrip(2) = lblShape.Top + lblShape.Height
lblGrip(0).Move XGrip(0), YGrip(0)
lblGrip(1).Move XGrip(0), YGrip(1)
lblGrip(2).Move XGrip(0), YGrip(2)
lblGrip(3).Move XGrip(1), YGrip(2)
lblGrip(4).Move XGrip(2), YGrip(2)
lblGrip(5).Move XGrip(2), YGrip(1)
lblGrip(6).Move XGrip(2), YGrip(0)
lblGrip(7).Move XGrip(1), YGrip(0)
End Sub
_____________________________________________________________
to até com dor de cabeça tentando achar uma forma de fazer isso!! rs
se alguém tiver uma dica aihh por favor me ajude!!
em quanto isso eu vo tentando sozinho!! valeu!!!!!
Editado por juniorcyberLink para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.