|
Since DirectX 9 has been releases you can use DirectSound, which will let you use .NET Stream objects (and MemoryStream objects) for playing the sound.
One of the samples (PlaySound) included with the SDK shows you how to play audio files from the hard drive. All you *should* have to do is change it so one object uses a constructor taking a System.IO.Stream instead of the filename used in the sample.
[Line 173 of main.cs in the sample
change
<small>ApplicationBuffer = new SecondaryBuffer(name, ApplicationDevice);</small>
to
ApplicationBuffer = new SecondaryBuffer(myStream, ApplicationDevice);
Where myStream is a Stream returned from GetManifestResourceStream in our prior conversation.]
In doing so you will require your users to have DirectX 9 installed, which isn't something most users will have until some popular games come out using it. IMHO, just playing sounds isn't a very good reason to require DirectX 9, but I don't know everything about your program so it may be deserved.
HTH,
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I'm using the following code to send an output string to a printer but I need the printer to write it from Right to Left instead of Left to Right because otherwise it will be impossible to adjust specially with long text...
PrintFont = new Font("Tahoma", 10);
PrintDocument pd = new PrintDocument();
pd.DefaultPageSettings.PaperSize = pd.PrinterSettings.PaperSizes[(int)myRegistry.GetValue("Paper Size")];
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
Jassim
|
|
|
|
|
Is it possible to derive a class from RichEditBox and do my own painting? I've tried deriving from 'OnPaint' but the function never gets called, and theres no 'OwnerDrawPaint' or similar event. Is there anyway of doing my own painting?
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
|
I'm trying to paint my own 'regions' over the text itself, so the RichTextBox would do it's own ordinary painting, and then I'd paint a few translucent rectangles on top of it, but there doesn't seem to be any way of doing custom drawing in a rich text box.
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
|
and can u give an advice how to do that? I have tried your homepage, but 'Server not found'. I'd really appreciate how to do that.
--------
Dave
ps: and merry Christmas and happy New year....
|
|
|
|
|
I'm not sure what 'IOW' highlighting is, but basicly, every time the user types a character in the control, it tests for regions (any text between say '[' and ']') and then draws a transparent box over that part of the text.
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I'm not what IOW is too, but i need to draw normal rich box and then highlight sections od rich edit box, like section for input and another one output. And I need to know how to draw it.
--------
Dave
|
|
|
|
|
|
|
I've managed to get custom drawing in a RichTextBox by adding this line in the constructor (of the derived class):-
SetStyle(ControlStyles.UserPaint, true);
then overriding 'OnPaint'. However, it's really hard to make the control draw itself, the only way I can do it is like this:-
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
SetStyle(ControlStyles.UserPaint, false);
Refresh();
SetStyle(ControlStyles.UserPaint, true);
...custom painting here...
}
this code is the only way I've found of getting the text to be drawn, or the selection, and although you can then custom paint, it doesn't paint itself correctly, it uses the wrong font.
Any ideas anyone? By the way, neither Invalidate or Update cause the control to paint itself...
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I have read leppies' code briefly and I think it's much better way how to do that than "tricks" like
SetStyle(ControlStyles.UserPaint, false);
Refresh();
SetStyle(ControlStyles.UserPaint, true);
... although much more complicated.
--------
Dave
|
|
|
|
|
|
Well, just one thing is missing - finishing it
I need it for UI (at the end I want it look like Mathematica editor) of my symbolic math library and since I started writing the kernel couple days ago I guess there are other things to do than UI But I (generally) know how to do that, at least
--------
Dave
|
|
|
|
|
Friends,
How do I get the number of records in a OleDbDataReader ?
How do we move to the first record, if we reach the last record ?
<br />
OleDbCommand cmd = new OleDbCommand( "select description from test", conn );<br />
OleDbDataReader odr=cmd.ExecuteReader(CommandBehavior.CloseConnection);<br />
Smitha
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
|
Thanks Nish. So I got to do an extra query
BTW, Are you still doing C# ?
Smitha
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
|
I am not all that familiar with this DataReader problem and if I understand the problem correctly, you need to know how many items are in the result set before you process them and you wish to do this with only one query to the server. If your db provider supports multiple results sets you can execute one query such as:
SELECT COUNT(*) as CNT FROM MyTable
SELECT * FROM MyTable
Then in your code you would read the count from the first result and once you have the count, simply use the OleDbDataReader.NextResults member to switch to next result set which is you main query. This is one call to the server and in most cases will have little performance penalty.
Rocky Moore
|
|
|
|
|
How can I create Windows Installer setup package for my C# application if this option is not available/not working n my VS? are there any other FREE solutions?
Many Thanks,
jassim Rahma
Jassim
|
|
|
|
|
Hi Jassim
You could try Inno Setup which is free. But you'll have to distribute the .NET runtime and stuff like that on your own (unlike the VS installer, Inno wont automatically find and add dependencies for you - you gotta add them to the setup yourselves)
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Nishant S wrote:
unlike the VS installer
Even the VS.NET installer requires you to ship the framework separately. Currently it just throws up a Message Box with a message informing the user that they need the framework to install the program (the message is customizable)
There is a bootstrapper sample on MSDN that is supposed to detect/install the framework if needed, but I couldn't get it to work/compile.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
James T. Johnson wrote:
There is a bootstrapper sample on MSDN that is supposed to detect/install the framework if needed, but I couldn't get it to work/compile.
You've also got a merge module (.msm) to play with.
The cmdline with dotnetfx.exe has many options to check against the possibly existing run-time.
|
|
|
|
|
.S.Rod. wrote:
You've also got a merge module (.msm) to play with.
Yes, but if you include the merge module it will fail to build.
"ERROR: dotNETFXRedist_x86_enu.msm must not be used to redistribute the .NET Framework. Please exclude this merge module."
For some unknown reason MS decided they wouldn't let you include it in a setup project. I would think that defeats the purpose of having it in the first place; perhaps its for detected dependencies (mscorlib, etc).
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|