Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text Properties
#1
How do u giv text different properties e.g. Underline or Italic?

Tom[/i]
Reply
#2
In QB or on this forum? In QB you can't unless you write your own special code. On this forum, just click the buttons below the subject bar and above the textarea I'm typing in right now Wink
am an asshole. Get used to it.
Reply
#3
i meant in QB!

so does n e 1 know a way?!
Reply
#4
Run QB /L and load the program. Make an executable. Open a DOS program and run that program. (And read comments near end of program.)



'
' This program demonstrates how to change the fonts in a QB graphics
' video mode. (It makes all characters with ascii values from 32 to 127
' underlined.)
'
'$INCLUDE: 'QB.BI'
DIM CHAR(1 TO 1024) AS LONG, SM AS INTEGER, OS AS INTEGER, I AS INTEGER
DIM BYTE AS INTEGER, VS AS INTEGER, INREGS AS REGTYPEX, OUTREGS AS REGTYPEX
DIM MODE AS INTEGER, NBYTES AS INTEGER, SMORG AS INTEGER, OSORG AS INTEGER
DIM SMORG1 AS INTEGER, OSORG1 AS INTEGER,OS0 AS INTEGER,ASCII AS INTEGER
'
' Get location in memory of where font data is to go.
'
SM = VARSEG(CHAR(1)): OS = VARPTR(CHAR(1))
'
' Get video mode to use.
'
MODE = 0
WHILE MODE < 1 OR (MODE > 2 AND MODE < 7) OR MODE > 13
INPUT "WHAT QB GRAPHICS MODE DO YOU WANT"; MODE
WEND
SCREEN MODE
'
' Get character size.
'
DEF SEG = 0
VS = PEEK(&H485)
'
' If this routine doesn't work for you, print out the value of VS just
' obtained. If it's 14, uncomment the following line of code and see if
' that helps. (Some video boards require it.)
'
'IF VS = 14 THEN VS = 16
'
' Find out where font data is.
'
INREGS.AX = &H3543
CALL INTERRUPTX(&H21, INREGS, OUTREGS)
'
' Save IVT data.
'
SMORG = OUTREGS.ES: OSORG = OUTREGS.BX
'
' Read font data from video area and write it to array.
'
NBYTES = VS * 256
IF MODE < 7 THEN NBYTES = NBYTES / 2
FOR I = 0 TO NBYTES - 1
DEF SEG = OUTREGS.ES
BYTE = PEEK(I + OUTREGS.BX)
DEF SEG = SM
POKE I + OS, BYTE
NEXT I
'
' If MODE < 7, font data for ascii values > 127 are located elsewhere.
'
IF MODE < 7 THEN
INREGS.AX = &H351F
CALL INTERRUPTX(&H21, INREGS, OUTREGS)
SMORG1 = OUTREGS.ES: OSORG1 = OUTREGS.BX
FOR I = NBYTES TO 2 * NBYTES - 1
DEF SEG = OUTREGS.ES
BYTE = PEEK(I - NBYTES + OUTREGS.BX)
DEF SEG = SM
POKE I + OS, BYTE
NEXT I
END IF
'
' Underline characters. Note that (255 decimal = 11111111 binary.)
'
OS0=OS
FOR ASCII=32 TO 127
OS = (ASCII + 1) * VS + OS0 - 1
'
' Write underlining byte.
'
POKE OS, 255
NEXT ASCII
DEF SEG
'
' Change interrupt vector to memory location of array.
'
INREGS.DX = VARPTR(CHAR(1))
IF MODE > 6 THEN
INREGS.AX = &H2543
ELSE
INREGS.AX = &H251F
INREGS.DX = INREGS.DX + NBYTES
END IF
INREGS.DS = SM
CALL INTERRUPTX(&H21, INREGS, OUTREGS)
'
' Display text message.
'
PRINT "If you start typing, you should notice underlined characters.
'
'
' Terminate program with DOS termination routine to keep video mode from
' being reset (and thus destroying fonts just created).
'
INREGS.AX=&H4C00
CALL INTERRUPTX(&H21,INREGS,OUTREGS)
'
' If you don't want this program to terminate, leaving DOS set up to
' print underlined characters but instead just have your own code to use
' those characters *here*, delete or comment out the above two lines and
' uncomment the following ones. (They restore the original interrupt
' vectors.)
'
'INREGS.AX = &H2543
'INREGS.DS = SMORG
'INREGS.DX = OSORG
'CALL INTERRUPTX(&H21, INREGS, OUTREGS)
'IF MODE < 7 THEN
'INREGS.AX = &H251F
'INREGS.DS = SMORG1
'INREGS.DX = OSORG1
'CALL INTERRUPTX(&H21, INREGS, OUTREGS)
'END IF
END
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#5
No it cannot be done simply in QBasic, there may be librarys around that can do it tho.
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79][Image: safer.gif][/url]
END OF LINE.
Reply
#6
complicated (for the understatement of the millenium). (But it wouldn't be real complicated without libraries.)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)