|
Thank you man...
I'll try with Dock and Anchor properties...finally I can start to code a "real" program.
Thank you again!
Bye.
Max
|
|
|
|
|
I am writing a small custom win form control (i.e. UserControl). I would like to pop up a wizard the first time the user places the control on a windows form. I cannot figure out how to tell the first time a control is places??? I cannot seem to find any methods or properties in the designer class. Can anyone help here? Thanks!
|
|
|
|
|
Implement a ControlDesigner for your class and attribute your UserControl with the DesignerAttribute specifying the Type or type string for the designer class. In your implementation of Initialize or OnSetComponentDefaults , you could pop up a wizard dialog or whatever you want.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Does anyone know what is equivelent of "strstr" in VC# ? Thanks.
|
|
|
|
|
See String.IndexOf and related methods in the .NET Framework SDK documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You can use the IndexOf method of the string class, of course it does not return a pointer like strstr does.
|
|
|
|
|
|
Background:
I'm trying to write a media player that supports various file and playlist types, cd ripping, format conversion, etc. Pretty standard "media player" stuff really.
The first task is to enable playback.
Issues:
I've downloaded the DirectX SDK Summer 2003 update, and audio/video playback is supported by using C#. This rather simple playback however, and not what I'm looking for. I also noticed that DirectShow cannot be used directly by C#, and I have looked at several code snippets using Interop. Allthough Interop will give me the results I'm looking for, the approach to get those results using Interop ar not to my liking.
Possible solutions:
- Anyone know if there will be "managed directshow" for C#? I noticed in the DirectX SDK that they write "This is preliminary documentation and is subject to change." on almost every topic I searched on.
- Learn C++. This would be a solution that I know would work, I would like to use C# though.
- Create C++ backend dll's for the complex work and C# for interface etc... This is just a thought, I haven't found any articles actually building applications this way.
Last words:
Right now, the media player is a bunch of notes on a paper, and I would really like your thoughts/ideas/input on multimedia in C#.
-thorbeck
"Computers are stupid,
they can only give you answers."
picasso
|
|
|
|
|
|
First off, thanks for the link.
That site had some other interesting source codes aswell.
I'm aware of using "winmm.dll" through Interop, but this will bring me to a halt when further development on the media player is to be continued.
I feel the lack of complete control when using Interop and try to avoid it whenever possible, allthough it seems that for the moment I have to stick with it unless I crawl into the unexplored world of C++.
For the moment, C++ has the power to do what I want.
I.e. auto gain, dsp, equalizer, crossfading, 5.1 output, etc..
I spend alot of time learning C#, and enjoy coding, but I don't have the time to learn yet another language.
To give you an idea of what I want to write take a look at http://foobar2000.org/[^].
And if I ever get this huge rock rolling, it will be open source...
-thorbeck
"Computers are stupid,
they can only give you answers."
picasso
|
|
|
|
|
That site had some other interesting source codes aswell.
Yeah, they sure do.
I'm aware of using "winmm.dll" through Interop, but this will bring me to a halt when further development on the media player is to be continued.
I feel the lack of complete control when using Interop and try to avoid it whenever possible, allthough it seems that for the moment I have to stick with it unless I crawl into the unexplored world of C++.
Yes, I dislike using Interlop as well, but there isn't much I can do about it.
For the moment, C++ has the power to do what I want.
I.e. auto gain, dsp, equalizer, crossfading, 5.1 output, etc..
This is true. Maybe you should try to look for a componet written in C++ that already does this.
I spend alot of time learning C#, and enjoy coding, but I don't have the time to learn yet another language.
Same here unfortunately.
To give you an idea of what I want to write take a look at http://foobar2000.org/[^].
Interesting.
And if I ever get this huge rock rolling, it will be open source...
Sweet. I am trying to make a media player as well. Only with mine, I am not going for the features of a standard media player, but a "weighted random" player. (i.e., if rating is ten play most often, if rating is one play almost never. Just think radio station... Play the best songs often, bad songs rarely) I would be happy to work with you on creating the media player.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
Sweet. I am trying to make a media player as well. Only with mine, I am not going for the features of a standard media player, but a "weighted random" player. (i.e., if rating is ten play most often, if rating is one play almost never. Just think radio station... Play the best songs often, bad songs rarely) I would be happy to work with you on creating the media player
weird, i wanted to make one like that too. did you get something done yet?
is it available for download.
i read once an article in dr. dobbs journal and it had nice algorithm for figuring out "best songs".
|
|
|
|
|
weird, i wanted to make one like that too. did you get something done yet?
Yes, I am working on it. It works (sorta), but there are a lot of bugs, and it doesn't have a playlist editor, so you just have to edit the playlist by hand (nasty business), and it doesn't read XML yet
is it available for download.
Not yet, but I'll post it on CP when I finish it.
i read once an article in dr. dobbs journal and it had nice algorithm for figuring out "best songs".
Interesting, but I made my own algorithm. The general principal for mine, is to use a bellcurve to chose which song rating should be played, then randomly chose from the songs with that rating.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
If you thought that the Managed DirectX is REALLY "managed" you are terribly mistaken. It is nothing more then an MUCH improved wrapper for the Direct X unmanaged code. But still it is not too far off from a standard Interop assembly automatically generated by tlbimp. So I don't think that you will be hurting your design much by using Interop DirectShow.
|
|
|
|
|
Then I have been terribly mistaken, but thanks for being a light in a very dark tunnel...
At least now I know where I stand, and if I notice performance issues I might look more into C++.
-thorbeck
"Computers are stupid,
they can only give you answers."
picasso
|
|
|
|
|
I'm using a float to keep track of a scale factor -- sounds easy enough. When the user clicks a button I either add or subtract 0.10F from the scale value (it starts at 1.0F). After several iterations I start to see the value varing by a small amount i.e instead of 0.80 I get .7999. This seems like a large error for a simple addition or subtraction operation... Any insights?
|
|
|
|
|
This is because of the internal representation of a float type. When you store a number in a 32-bit float, you're not storing the absolute precise version of the number. You actually storing a mantissa and exponent. Try this[^] for a very short explanation as to why...
0.1 in decimal does NOT = 0.1 represented in IEEE754 format.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'd have to read the IEEE754 spec to see why it's different than normal FP calculations, i.e. the same calcutions in C/C++ work fine with floats, but are way off with both floats and doubles in C#. I understand the internal FP representation, but I haven't seen this bad/apperant/annoying of a problem for some years, hmmm maybe somewhat over a decade or more....
|
|
|
|
|
I've had to deal with it for years. I've always used the 'integer' technique simply because math with int's are much quicker than with floats. Only when I must use floats/doubles do they get converted back to their floating point counterparts.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Use an integer for the scale factor.
Start at 100:
int iScale = 100;
Move up or down by 10.
iScale += 10;
Convert to float before using:
float fScale = (float)iScale/100f;
This should keep your scaling the way you want.
|
|
|
|
|
Thanks. I had considered the integer solution, it will work for the case outlined but if the scalinng capability is expanded to include "To width" etc... it may not not work as well, though I may be able to adjust the precision to account for those situtations.
|
|
|
|
|
Have you considered using the decimal data type? It does not lose precision since it is intended for decimal arithmetic.
|
|
|
|
|
Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application...
Yes, decimals are stored as 16 bytes (but only 13 of them are used, pity) In any case they're much slower than a float, since they are structs and do not have hardware support. But I think it's OK unless you're programming a game or an embedded system in a spaceship 
|
|
|
|
|
No, I don't think that I'll use decimal, espcially since I was worried that converting the int to a float every thime the window was invalidate would be too expensive (a few second later I figured out that I could store both -- do the math on the int and convert to float whe the scale changes.)
I guess the major question is why when you write a prog in C/C++ do you get the "right"/expexted answer and in C# you don't. Ah well, if it still bothers me tommorrow I may take a journey down assembly lane and look at the disassembly for the C code. Another thing I was considering checking is to simply assign various values to a float an view the results...
|
|
|
|