|
geestje wrote:
Ok, I'll solve it that way: scale it and fill the rest with white pixels.
Actually you'll want to clear it and fill it with white pixels first (you can do that with one call; read about Graphics.Clear ) then scale and draw your image.
It's not weird at all if you understand what these objects actually are. A PictureBox draws an image into an HDC for a window (a control is a window in native terms). An ImageList is a wrapper around a native GDI+ ImageList that draws whatever you give it into an HDC for the images it contains. It is meant only to hold images - not to display them to users. It is the control that uses the images that defines how those images are drawn. Think of it as a simple collection.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I had to create my own form to get files from my directory because i had to add allot of functionality not available on the system dialog boxes (done with that) now my problem is i need to pass on the selected files from my directory form to my main form...i can't get this to happen...can anyone help??...this is how i'm calling my second form:
private void mnu_Open_Click(object sender, System.EventArgs e)
{
Form2 myMenu = new Form2();
Menu.Show();
}
|
|
|
|
|
If I understand you correctly, you can have property ( or internal field) with data you want to pass...
It can look like :
<br />
class Form2:.... {<br />
...<br />
<br />
public string[] Files<br />
{<br />
get<br />
{<br />
return m_files;<br />
}<br />
}<br />
}<br />
<br />
private void mnu_Open_Click(object sender, System.EventArgs e)<br />
{<br />
Form2 myMenu = new Form2();<br />
<br />
myMenu.Show();<br />
<br />
DoSomethingWith(myMenu.Files);<br />
}<br />
Does it help?
bets regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
And out of mercy to those who might have to read your code, you might want to use a more meaningful name than "Form2" for the thing. As well, myMenu = new Form(); is a bit confusing -- is it a form or a menu?
Additionally, you might want to use ShowDialog() and also set the dialog result values appropriately, so you can use your dialog as you would an OpenFileDialog, for example:
if( openFileDialog.ShowDialog(this) == DialogResult.OK )
{
}
Matt Gerrans
|
|
|
|
|
Matt,
I didn't ask you for your judgment i asked for some help. You unlike the other guy were of no assistance. Oh btw...I simplified the code down to a textbook manner so that i can get my point across without copying my entire file into the thread...next time give your opinion when asked for it.
|
|
|
|
|
Okay, sorry about adding the editorial. I removed that part, but I hope at least the part about the ShowDialog() and the DialogResults was helpful.
Matt Gerrans
|
|
|
|
|
You don't need to apoligize for correcting bad examples. Many times in this forum some people post bad examples that foster bad coding in other developers. Nothing leads to poor quality software than code written half-assed.
|
|
|
|
|
Thanks that solved my problem.
|
|
|
|
|
hello i have a custom control that inherits a rich textbox i had this control on my main form and then suddenly it dissapeared and i can no longer drag the control onto the form i do have a designer but it hasnt helped waht could possibly not allow me to be able to use my control at design time
|
|
|
|
|
.Net Designer does not support the overloaded constructors of the controls in it, If your user control has some controls which have overloaded constructors, there is probability that your contituent controls get disappered when you drop it on the form.
|
|
|
|
|
it just hase a normal constructor any other ideas?
|
|
|
|
|
I am sorry, I was aware of this only.
|
|
|
|
|
More than likely you left the default AssemblyVersionAttribute value in your AssemblyInfo.cs file with the asterisk (*) in it. Every time you compile your project the assembly version is changed. Unlike Win32 DLLs, the assembly version matters. A Type is a completely different Type even if the assembly which defines it differs in version.
So, either include a project dependency instead of a file dependency if both projets are in the same solution (after opening "Add Reference...", click the Project tab instead of the default .NET tab); or, define a constant version number and control your versioning. You'll need to remove the reference to your older assembly and include the new, hard-coded versioned assembly then re-add your control.
For more information about assembly versions read the .NET Framework SDK that was installed by defualt with VS.NET, is available stand-alone at http://msdn.microsoft.com/netframework[^], and that is available online at http://msdn.microsoft.com/library[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello, please can anyone help. I need the article and source code for the C# Sorted ListView by Carlos H. Perez, as it is not at the following link anymore.
http://www.codeproject.com/cs/miscctrl/sortedlistview.asp
If anyone has the sourcecode please can they send it me.
Kindest Regards
Mike
|
|
|
|
|
Since you didn't sign in before you posted, anybody who wants to help you out can't because they can't email you through CP.
"A people that values its privileges above its principles soon loses both." -- Dwight D. Eisenhower
|
|
|
|
|
Is it possible to play ADPCM WAVE and WMA from memory? I'm reading a file into memory and taking sections of it which I know to be sound, some are 22050 kbps mono, some 44100 kbps stereo and some WMA. I can take the WMA data and dump it stright into a file, so I could just use Windows Media Player to play that, but I somehow need to create a header for the ADPCM sounds, all I've got is pure audio data. Any ideas?
|
|
|
|
|
Of course it can be read from memory - that's how media players play files; they read them into memory and play them. The question is what are you using to play the sound? Are you interop'ing with the Windows Media Player typelib (having created an RCW, or Runtime Callable Wrapper - i.e., an "interop assembly")? If so, then no. Typelibs are meant to expose functionality to callers in a typically simple manner. Most callers would never need to play a file from memory.
If you were using the Managed DirectX[^] assemblies, however, you could use a MemoryStream as input to a DirectSound Buffer or another suitable class. Download and install the DirectX SDK, along with the managed assemblies for interoperability with the .NET Framework written from the ground up (not just simple inteorp assemblies or wrappers like some projects used before Managed DirectX 9).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Sorry I didn't make myself clear, the problem is I'm not sure how to play it, I've figured out the ADPCM header now, so the problem is playing the actual sound. DirectX seems to be the best way to go, can you give me a link to a tutorial or something?
|
|
|
|
|
I understood that you didn't know how to play it. Follow the link I already gave you in my first reply for documentation, downloads, and articles. If you are looking for addition tutorials I suggest you search either this site using the search textbox above (although I'll warn you that most of the articles about DirectX wrap the older APIs themselves instead of using Managed DirectX) or google.
If you're sure this sound will always be a simple PCM audio clip you could P/Invoke the rather extensive set of Windows Multimedia APIs, which you can read about at http://msdn.microsoft.com/library/en-us/dnanchor/html/anch_WindowsMultimedia.asp[^].
If you're not sure about the encoding of the file (i.e., whether it's MP3, WMA, or anything else) then you should use DirectX which enumerates and uses all the audio and video codecs installed on teh system without having to worry about decoding the data yourself into waveform.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I'm looking through the MSDN now. I think I can see a problem though, the WaveFormatTag only has PCM, does it only support uncompressed PCM, or does it also allow ADPCM? Also do you know of anywhere that has documentation on the ADPCM WAVE header? I've found general documentation on the WAVE (RIFF) format, but there's inconsistancies, such as Block Align being Bit Rate / 8 * Channels. This would mean 4bit ADPCM block aling would be 0.5, in a sample ADPCM file I've encoded the value is 512 (format was 22.050 mono)
|
|
|
|
|
The best place to find this information is in the headers. Download and install the Platform SDK[^] and find the APIs that would use the header information (typically a struct). At the bottom of the documentation for these APIs is listed which header they are declared in. With some digging you can find the actual structs. This is what I did when I wrote an icon extractor (that extracts the actual icon data - not an HICON ) to find the icon structure.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have an assignment to traverse a parent-child chain of controls that are arranged so that the master parent has one child, and then that child has a child, and then that child has one child, and then that child has one child. In other words, the arrangement is similar to that of a russian doll, where there is a hollow man, which contains another hollow man, and so on until you reach the center. Now the code, the code is all incorporated inside of a single click event. Would it be similar to?
private int ctrl_click(object sender, EventArgs e)
{
Control ctrl_hold;
int intControlCounter = 1;
while (ctrl.HasChildren == true)
{
if (ctrl.HasChildren)
{
intControlCounter += 1;
ctrl_hold = ctrl;
}
else
{
exit while;
}
}
}
When there is a control arranged in a chain of parent-child relationships, even if there were code such as: ctrl.HasChildren.count, it would only return a result of 1. How would I traverse the chain of controls arranged in such a way and come back with a result of the number of controls? Would REALLY APPRECIATE some assistance, as Microsoft did not document the parent-child relationship code very well.
|
|
|
|
|
You have to recursively search through alle controls.
Some code (untested)
<br />
public int GetCount(Control control) {<br />
int count = 0;<br />
foreach (Control childControl in control) {<br />
count += GetCount(childControl);<br />
}<br />
return count + 1;
}<br />
|
|
|
|
|
Thank you, Robert ! ! ! Your sample code got me pointed in a totally different direction, that enabled me to solve the problem. I appreciate it.
|
|
|
|
|
Hi all, I found this article in CodeProject:
http://www.codeproject.com/csharp/FTwin32Timers.asp[^]
I was wondering if anyone else could back this up (i.e. encoutered the problem), and the most important thing:
In the article, it says that the "other" timers DIDN'T work. Does anyone understand which timers the author is talking about? Maybe System.Threading.Timer objects? Or maybe something else?
Thanks.
/=/=/=/= Sagmam =\=\=\=\
|
|
|
|