[résolu) Soucis CanvasGadget et API lignes pointillées.
Publié : sam. 13/oct./2012 20:27
bonsoir
Ptit problème avec CanvasGadget avec une couleur de fond pour afficher les styles de ligne avec L'API Windows ,
Je n'y arrive pas.
sur fond noir elle s'affiche avec le rouge et avec du blanc que je n''ai pas choisi.
Alors que sur un fond blanc, aucun soucis les lignes pointillés sont affichées correctement.
j'ai également essayé le mode XOR de l'API, mais là aussi rien à faire, je n' obtiens qu'un pointillé bleu ciel.
donc voilà le code, si quelqu'un a une solution.. merci
avec PB 461 et PB 5.b5
Cordialement
Ptit problème avec CanvasGadget avec une couleur de fond pour afficher les styles de ligne avec L'API Windows ,
Je n'y arrive pas.

Alors que sur un fond blanc, aucun soucis les lignes pointillés sont affichées correctement.
j'ai également essayé le mode XOR de l'API, mais là aussi rien à faire, je n' obtiens qu'un pointillé bleu ciel.
donc voilà le code, si quelqu'un a une solution.. merci
avec PB 461 et PB 5.b5
Cordialement
Code : Tout sélectionner
#Window = 0
#Canvas = 1
#Window_Width = 800
#Window_Height = 600
#AxeX = #Window_Width / 2
#AxeY = #Window_Height / 2
#rayon = 195
Procedure Ligne(DC,x1,y1,x,y,Width,style,color)
;#PS_SOLID style=0:#PS_DASH style=1:#PS_DOT style=2:#PS_DASHDOT style=3:#PS_DASHDOTDOT style=4
pen=CreatePen_(style,Width,color) ;
hPenOld=SelectObject_(DC,pen)
;nDrawMode=SetROP2_(DC,0) ;#R2_MASKPEN #R2_COPYPEN Etc.. de 0 à 15
MoveToEx_(DC,x1,y1,0):LineTo_(DC,x,y)
;SetROP2_(DC,nDrawMode)
DeleteObject_(pen)
DeleteObject_(hPenOld)
EndProcedure
OpenWindow(#Window, 0, 0, #Window_Width,#Window_Height, "PureBasic ", #WS_SYSMENU)
CanvasGadget(#Canvas, 0, 0,#Window_Width,#Window_Height,#PB_Canvas_ClipMouse)
StartDrawing(CanvasOutput(#Canvas))
;Box(0,0,GadgetWidth(1),GadgetHeight(1),RGB(255,255,255))
Box(0,0,GadgetWidth(1),GadgetHeight(1),RGB(70,70,70))
StopDrawing()
DC=StartDrawing(CanvasOutput(#Canvas))
DrawImage(#PB_Canvas_Image, 0, 0 ,#Window_Width,#Window_Height)
x = Round(#AxeX + (#rayon) * Sin(Radian(90)),#PB_Round_Nearest)
y = Round(#AxeY + (#rayon) * Cos(Radian(90)),#PB_Round_Nearest)
Ligne(DC,#AxeX ,#AxeY ,x ,y,1,3,#Red)
StopDrawing()
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow