playing with Strings

  • Thread starter Thread starter Ehsan Sadeghi
  • Start date Start date
E

Ehsan Sadeghi

Hello
Lets say i have a string like
String myString ="This is a test";
and say i have an array of wave files that holds the wave form of each
substring in mySting .
say it's
myStringWaveForm[];

i'm going to show myString inside a paintbox so i use something like
g.DrawString(...)

my question is how can i change the colour of each substring, i can draw
each substrin with myString.Substring() , while i'm using PlaySound() to
read it(substring)..

and something else how should i store all my wave file insude one file or at
least store all the wave form one one string inside one file?


Regards
Ehsan Sadeghi
 
Ehsan Sadeghi said:
Lets say i have a string like
String myString ="This is a test";
and say i have an array of wave files that holds the wave form of each
substring in mySting .
say it's
myStringWaveForm[];

i'm going to show myString inside a paintbox so i use something like
g.DrawString(...)

my question is how can i change the colour of each substring, i can draw
each substrin with myString.Substring() , while i'm using PlaySound() to
read it(substring)..

When you call g.DrawString, use a brush of the suitable colour. Strings
themselves don't have any presentation information associated with
them.
and something else how should i store all my wave file insude one file or at
least store all the wave form one one string inside one file?

I'm not sure exactly what you're asking for here, but
BinaryWriter/BinaryReader may well help you.
 
Hello
I mean for example i like to show the entire text which is " This is a test"
and then using the wave files which i have first read "This" from the string
and at the same time change its colour ( colour of "This") to "red" while
the rest of the text is in black.

regards
Ehsan


Jon Skeet said:
Ehsan Sadeghi said:
Lets say i have a string like
String myString ="This is a test";
and say i have an array of wave files that holds the wave form of each
substring in mySting .
say it's
myStringWaveForm[];

i'm going to show myString inside a paintbox so i use something like
g.DrawString(...)

my question is how can i change the colour of each substring, i can draw
each substrin with myString.Substring() , while i'm using PlaySound() to
read it(substring)..

When you call g.DrawString, use a brush of the suitable colour. Strings
themselves don't have any presentation information associated with
them.
and something else how should i store all my wave file insude one file or at
least store all the wave form one one string inside one file?

I'm not sure exactly what you're asking for here, but
BinaryWriter/BinaryReader may well help you.
 
Ehsan Sadeghi said:
I mean for example i like to show the entire text which is " This is a test"
and then using the wave files which i have first read "This" from the string
and at the same time change its colour ( colour of "This") to "red" while
the rest of the text is in black.

Sure - so you call g.DrawString with "This" with a red brush, then
g.DrawString with " is a test" with a black brush.

Admittedly you might find it easier with a RichTextBox.
 
Back
Top