Sources PureBasic

Sources PureBasicConsultez toutes les sources
Nombre d'auteurs : 41, nombre de sources : 88, dernière mise à jour : 13 août 2011
Sommaire→Gadgets→EditorGadget
Valable uniquement avec Windows (utilisation de l'API).
Ce code permet d'afficher un texte en rouge dans un EditorGadget, et de le souligner en bleu.
#CFU_UNDERLINENONE = 0
#CFM_UNDERLINETYPE = $800000
#CFU_UNDERLINEWAVE = $8
#BlueUnderline = $10
#CyanUnderline = $20
#GreenUnderline = $30
#MagentaUnderline = $40
#RedUnderline = $50
#YellowUnderline = $60
#AquaUnderline = $90
#SeaGreenUnderline = $A0
#MaroonUnderline = $C0
If OpenWindow(0, 0, 0, 400, 300, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 10, 40, 380, 250)
cf2.CHARFORMAT2
cf2\cbSize = SizeOf(CHARFORMAT2)
cf2\dwMask = #CFM_UNDERLINETYPE | #CFM_SIZE | #CFM_COLOR
cf2\yheight = 400
cf2\crTextColor = #Red
cf2\bUnderlineType = #CFU_UNDERLINEWAVE | #BlueUnderline
SendMessage_(GadgetID(0), #EM_SETCHARFORMAT, #SCF_ALL, cf2)
AddGadgetItem(0, -1, "PureBasic Test")
ButtonGadget(1, 10, 10, 100, 30, "Remove Underline")
Repeat
event = WaitWindowEvent()
If EventType() = #PB_EventType_LeftClick And EventGadget() = 1
cf2\cbSize = SizeOf(CHARFORMAT2)
cf2\dwMask = #CFM_UNDERLINETYPE
cf2\bUnderlineType = #CFU_UNDERLINENONE
SendMessage_(GadgetID(0), #EM_SETCHARFORMAT, #SCF_ALL, cf2)
EndIf
Until event = #PB_Event_CloseWindow
EndIf
End


