Code : Tout sélectionner
; ScintillaSendMessage(0, #SCI_STYLESETFONT, #STYLE_DEFAULT, @"Consolas")
; ScintillaSendMessage(0, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 10)

J'ai donc cherché un peu partout et trouvé une méthode qui marche,
mais 7 lignes contre une, ce n'est pas top

Code : Tout sélectionner
OpenWindow(0, 0, 0, 800, 600, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If Not InitScintilla()
End
EndIf
ScintillaGadget(0, 10, 10, 780, 580, 0)
; Ne fonctionne pas
; ScintillaSendMessage(0, #SCI_STYLESETFONT, #STYLE_DEFAULT, @"Consolas")
; ScintillaSendMessage(0, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 10)
; Fonctionne
Define *FontName = AllocateMemory(StringByteLength("Consolas", #PB_Ascii) + 1)
If *FontName
PokeS(*FontName, "Consolas", -1, #PB_Ascii)
ScintillaSendMessage(0, #SCI_STYLESETFONT, #STYLE_DEFAULT, *FontName)
ScintillaSendMessage(0, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 10)
FreeMemory(*FontName)
EndIf
; Marge de numéros de ligne
ScintillaSendMessage(0, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER) ;
ScintillaSendMessage(0, #SCI_SETMARGINWIDTHN, 0, 50)
ScintillaSendMessage(0, #SCI_STYLESETBACK, #STYLE_LINENUMBER, $DCDCDC)
ScintillaSendMessage(0, #SCI_STYLESETFORE, #STYLE_LINENUMBER, $808080)
; Ligne en cours
ScintillaSendMessage(0, #SCI_SETCARETLINEBACK, $00FFFF)
ScintillaSendMessage(0, #SCI_SETCARETLINEVISIBLE, #True)
; Couleur de la sélection
ScintillaSendMessage(0, #SCI_SETSELBACK, #True, $FF901E)
ScintillaSendMessage(0, #SCI_SETSELFORE, #True, $0)
; Test: un fichier de 7000 lignes
Define FileName.s = "C:\Program Files\PureBasic\Compilers\APIFunctionListing.txt"
If Not ReadFile(0, FileName)
End
EndIf
Define FileType = ReadStringFormat(0)
Define Size = FileSize(FileName)
Define *Buffer = AllocateMemory(Size)
If *Buffer
ReadData(0, *Buffer, Size)
CloseFile(0)
Define Text.s = PeekS(*Buffer, Size, FileType)
FreeMemory(*Buffer)
EndIf
ScintillaSendMessage(0, #SCI_SETTEXT, 0, UTF8(Text))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
