habe leidiges Problem bei meiner Rotstiftkorrektur. Wenn ich auf Linienstärke drücke, dann habe ich zwar die Stärke, aber gleich auch einen Punkt in meinen ImageGadget.
Hab versucht den Klick abzufangen, gelingt mir aber nicht, vieleicht kennt einer dieses Problem?
Code: Alles auswählen
;-Constantes
Enumeration
#Window
#RotstiftImage
#RotstiftLinienfarbe
#Rotstiftstaerke
#Rotstifttext
#RingButtonContainer_x
#RotstiftSpeichern
EndEnumeration
;-Fonts
Enumeration
#Font_Bildtext
#Font_ComboLinienstaerke
EndEnumeration
UsePNGImageDecoder()
UsePNGImageEncoder()
;Globlae Images
Global RotstiftStatusOn = 1
Global RotstiftShowLine.i, Start.Point
Global Rotstift_Ringbutton
Global Rotstift_Y_GadgetOffset = 43
Global Rotstift_X_GadgetOffset = 9
Global Rotstift_Color.l
Global Rotstift_Linienstaerke
Global Rotstift_Disaeble
;Image
Enumeration
#RotstiftBild
#RotstiftBildVorlage
#LoadImage
#Ringbutton
#Editor_ImageFC
EndEnumeration
Rotstift_Ringbutton=CatchImage(#Ringbutton,?RingbuttonImage)
CreateImage(#Editor_ImageFC,25,25)
DataSection
RingbuttonImage:
IncludeBinary "D:\Pure@Store\DESIGN_PROFI_STANDARD\Ringbutton.png"
EndDataSection
Procedure RotstiftThickLineXY(X1.i, Y1.i, X2.i, Y2.i, Thickness.i, Rotstift_Color.i)
Protected Length.i = Sqr((X2-X1)*(X2-X1)+(Y2-Y1)*(Y2-Y1))
Protected I, DeltaX.i, DeltaY.i
If Length = 0
Circle(X1, Y1, Thickness/2, Rotstift_Color)
Else
For I = 0 To Length
DeltaX = (X2-X1)*I/Length
DeltaY = (Y2-Y1)*I/Length
Circle(X1+DeltaX, Y1+DeltaY, Thickness/2, Rotstift_Color)
Next
EndIf
EndProcedure
OpenWindow(#Window, 0, 0, 637, 706, "Fenster", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
ButtonImageGadget (#RotstiftLinienfarbe, 0,0,30,30 , ImageID(#Editor_ImageFC))
ComboBoxGadget(#Rotstiftstaerke, 31, 2, 62, 30)
SetGadgetFont(#Rotstiftstaerke, LoadFont(#Font_ComboLinienstaerke, "Arial", 13, #PB_Font_Bold|#PB_Font_HighQuality))
ButtonGadget(#Rotstifttext,95,0,30,30, "T")
SetGadgetFont(#Rotstifttext, LoadFont(#Font_Bildtext, "Arial", 16, #PB_Font_Bold|#PB_Font_HighQuality))
ButtonImageGadget(#RingButtonContainer_x, 126, 0, 477, 30,Rotstift_Ringbutton )
ButtonGadget(#RotstiftSpeichern, 605,0,30,30, "S")
ImageGadget(#RotstiftImage, 9, 43, 650, 650,0)
DisableGadget(#RotstiftImage,1)
For RotstiftCount = 1 To 40
AddGadgetItem(#Rotstiftstaerke, -1, " "+Str(RotstiftCount))
SetGadgetItemData(#Rotstiftstaerke, CountGadgetItems(#Rotstiftstaerke)-1, RotstiftCount)
Next
SetGadgetState(#Rotstiftstaerke,4)
RotstiftStatusOn = 1
If RotstiftStatusOn = 1
CreateImage(#RotstiftBildVorlage, 512, 512)
StartDrawing(ImageOutput(#RotstiftBildVorlage))
Box(0,0,512,512,RGB(255, 215, 0))
StopDrawing()
ResizeImage (#RotstiftBildVorlage,650,650 ,#PB_ImagePlugin_PNG)
CopyImage(#RotstiftBildVorlage,#RotstiftBild)
SetGadgetState(#RotstiftImage, ImageID(#RotstiftBild))
EndIf
Repeat
Event = WaitWindowEvent()
Debug event
Select EventGadget()
; Rotstift
Case #RotstiftLinienfarbe
If RotstiftStatusOn = 1
Rotstift_Color=ColorRequester()
StartDrawing(ImageOutput(#Editor_ImageFC))
Box(0,0,ImageWidth(#Editor_ImageFC),ImageHeight(#Editor_ImageFC), Rotstift_Color)
StopDrawing()
SetGadgetAttribute(#RotstiftLinienfarbe , #PB_Button_Image , ImageID(#Editor_ImageFC))
RotstiftShowLine = #False
Rotstift_Disaeble = #True
EndIf
Case #Rotstifttext
Rotstift_Disaeble = #True
Debug Rotstift_Disaeble
; Rotstift speichern
Case #RotstiftSpeichern
If RotstiftStatusOn = 1
SaveImage(#RotstiftBildVorlage, "D:\TestImage.png", #PB_ImagePlugin_PNG)
EndIf
EndSelect
Select Event
Case #PB_Event_CloseWindow
End
Case #Rotstiftstaerke
Select EventType()
Case #PB_EventType_LeftClick
Debug "Linksklick"
Rotstift_Disaeble = #True
Debug Rotstift_Disaeble
EndSelect
Case #WM_RBUTTONDOWN
Debug Rotstift_Disaeble
Rotstift_Disaeble = #False
If RotstiftStatusOn = 1
RotstiftDeleter = #True
RotstiftShowLine = #False
RotstiftStart_X = WindowMouseX(#Window)-Rotstift_X_GadgetOffset
RotstiftStart_Y = WindowMouseY(#Window)-Rotstift_Y_GadgetOffset
EndIf
Case #WM_LBUTTONDOWN
If RotstiftStatusOn = 1
RotstiftShowLine = #True
RotstiftStart_X = WindowMouseX(#Window)-Rotstift_X_GadgetOffset
RotstiftStart_Y = WindowMouseY(#Window)-Rotstift_Y_GadgetOffset
EndIf
Case #WM_MOUSEMOVE
If Rotstift_Disaeble = #False
If RotstiftStatusOn = 1
If RotstiftShowLine
StartDrawing(ImageOutput(#RotstiftBild))
DrawImage(ImageID(#RotstiftBildVorlage), 0, 0)
Rotstift_Linienstaerke= Val(GetGadgetText(#Rotstiftstaerke))
;LineXY(WindowMouseX(#Window)-Rotstift_X_GadgetOffset, WindowMouseY(#Window)-Rotstift_Y_GadgetOffset, RotstiftStart_X, RotstiftStart_Y, Rotstift_Color)
RotstiftThickLineXY(WindowMouseX(#Window)-Rotstift_X_GadgetOffset, WindowMouseY(#Window)-Rotstift_Y_GadgetOffset, RotstiftStart_X, RotstiftStart_Y, Rotstift_Linienstaerke, Rotstift_Color)
StopDrawing()
SetGadgetState(#RotstiftImage,ImageID(#RotstiftBild))
EndIf
If RotstiftDeleter
StartDrawing(ImageOutput(#RotstiftBild))
DrawImage(ImageID(#RotstiftBildVorlage), 0, 0)
Circle(WindowMouseX(#Window)-Rotstift_X_GadgetOffset, WindowMouseY(#Window)-Rotstift_Y_GadgetOffset, 10, RGB(255, 215, 0))
StopDrawing()
SetGadgetState(#RotstiftImage,ImageID(#RotstiftBild))
CopyImage(#RotstiftBild,#RotstiftBildVorlage)
EndIf
EndIf
EndIf
Case #WM_LBUTTONUP
If Rotstift_Disaeble = #False
If RotstiftStatusOn = 1
RotstiftShowLine = #False
StartDrawing(ImageOutput(#RotstiftBildVorlage))
Rotstift_Linienstaerke= Val(GetGadgetText(#Rotstiftstaerke))
;LineXY(WindowMouseX(#Window)-Rotstift_X_GadgetOffset,WindowMouseY(#Window)-Rotstift_Y_GadgetOffset, RotstiftStart_X, RotstiftStart_Y, Rotstift_Color)
RotstiftThickLineXY(WindowMouseX(#Window)-Rotstift_X_GadgetOffset, WindowMouseY(#Window)-Rotstift_Y_GadgetOffset, RotstiftStart_X, RotstiftStart_Y, Rotstift_Linienstaerke, Rotstift_Color)
StopDrawing()
SetGadgetState(#RotstiftImage,ImageID(#RotstiftBildVorlage))
EndIf
EndIf
Case #WM_RBUTTONUP
If RotstiftStatusOn = 1
RotstiftDeleter = #False
EndIf
EndSelect
ForEver
;ColorRequester()
;Farbe = RGB(Rot, Grün, Blau)