I am writing a program for my Computer Science class and I am making a game for extra credit. What I need to know is how do you change the font color so that when it prints out on the screen the text is not just the regular white color but maybe blue, red, green, etc.
Thanks
Erik
3 40013 Ganon11 3,652
Recognized Expert Specialist
If you are using windows, and your output is in a standard DOS command prompt, you can use the following function call:
where f and g are color values. f is the background color, and g is the text color. The color values are as follows: - 0 = Black 8 = Gray
-
1 = Blue 9 = Light Blue
-
2 = Green A = Light Green
-
3 = Aqua B = Light Aqua
-
4 = Red C = Light Red
-
5 = Purple D = Light Purple
-
6 = Yellow E = Light Yellow
-
7 = White F = Bright White
For instance, if you wanted black background with red text, the function call would be
If your output is not in a command prompt, you may wish to consider using the conio library.
Is it possible to have for example, one line that is red, while the rest of the text is white? or does all of the text ( or background ) have to be the same color at any given time?
I am writing a program for my Computer Science class and I am making a game for extra credit. What I need to know is how do you change the font color so that when it prints out on the screen the text is not just the regular white color but maybe blue, red, green, etc.
Thanks
Erik
if u are working on linux, u may be using gtkmm, then these links may be of help
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/index.html
http://gtkmm.sourcefor ge.net/docs/gtkmm-2.4/docs/reference/html/group__Widgets. html
thanks
smitha
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Cengiz Ulku |
last post by:
Hi all,
I know now how to change the font name of a RTF file in a RTB control using,
for example:
RTextBox1.SelFontName = cmbFonts.Text
I have a RTF file -created with Word- displayed in a RTB control. Whenever I
change the font type during the runtime by selecting a font name from a
combobox -of all system fonts, the text changes its font correctly but I
loose some formatting such as a bold text and/or titles become normal text.
|
by: Paul D. Sullivan |
last post by:
I've been trying to find out how to increase the font size in the
text entry fields in Invision Power Board 1.3 for a while. The
part where you enter your post and do the quick reply and all
that has a really small font by comparision to the display font
in the forum, and I wanted to at least have the same size if
possible.
After some hours of working the issue, I tested about every
relevant entry in the Style Sheet. I found one line...
|
by: Ioannis Demetriades |
last post by:
Hi,
I need to change the printer's font to "control" -a printer font, and then
send a sequence of characters to the printer. My problem is that I cannot
change the printer's font. Can this be done without API calls?
Thanks
Ioannis
|
by: Sakharam Phapale |
last post by:
Hi All,
I am using a richTextBox control for text editing purpose. I have written
following procedure which change the font style of richTextBox.
Dim f as font = rtbData.selectionFont()
rtbData.SelectionFont = New Font(f, f.Style + (IIf(f.Bold, FontStyle.Bold
* -1, FontStyle.Bold)))
|
by: Sakharam Phapale |
last post by:
Hi All,
How to preserve the old font properties while changing new one?
I posted same question 2 months back, but I had very small time then.
eg. "Shopping for" is a text in RichTextBox and already formatted as
"Shopping" ---Bold
"for" -----Regular
Now I want to underline whole text by preserving old style i.e. Bold and
| |
by: mart2006 |
last post by:
Hi,
This is probably really simple to most of you but I have a PHP based website that I want to change the font (of the outputted HTML) and I'm really struggling! Here is a snippet of my code:
echo "<font face='arial' size='1'>";
echo "
<TABLE BORDER=1>
<TR>
|
by: phillip.s.powell |
last post by:
<style>
div div table tr td a.navbar, div div table tr td font {display:
none;}
</style>
<div class="navigationbar" style="background-color:Black; position:
absolute; left:50%; top:127px; margin-left: -400px; width: 800px;
height: 26px">
<!-- CODE GOES HERE -->
</div>
|
by: Blasting Cap |
last post by:
I am having trouble changing the font for a PushButton control in a
datagrid button column. I have seen several posts refer to styles and
simple changes to the HTML for font changes but most of those referred
to a LinkButton type of control. But in cases where someone is using the
PushButton there are no posted solutions. Whenever these changes are
made to the PushButton control they do not make any requested changes.
I have seen one...
|
by: nitehawk416 |
last post by:
I want to change the font of my rich text box to a font I downloaded. In the properties the font isn't there, so I tried changing it through the code with this variable declaration
Font MUDFONT = new Font("MUD 10",8, FontStyle.Regular);
and then calling it in the text changed function
private void DisplayBox_TextChanged(object sender, EventArgs e)
{
DisplayBox.Font = MUDFONT;
|
by: gubbachchi |
last post by:
Hi all,
Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |