|
I already gave that a try... it works fine for three panels. But increase that number to 5...
btw, I don't know the number of panels that will be displayed. The user can determine this at runtime.
Dennis
|
|
|
|
|
And you definitely don't want to start adding panels for each case, either. This adds a lot of overhead.
The Splitter class has both SplitterMoved and SplitterMoving events you could handle. Do handle these intelligently (i.e., writing intelligent code - not duplicating it) use the same event handler for each splitter and iterate through the splitters to change their size using the appropriate location and/or size properties:
private void resizeYoungerSiblings(object sender, EventArgs e)
{
Splitter split = sender as Splitter;
if (split != null)
{
int index = Controls.GetChildIndex(split);
if (index >-1)
{
for (int i=index; i<Controls.Count; i++)
{
Splitter sibling = Controls[i] as Splitter;
if (sibling != null)
{
}
}
}
}
} You don't have to worry about this event handler being called for resizing the other splitters since the event is only fired by mouse events (OnMouseMove calls OnSplitterMoving ).
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]
|
|
|
|
|
Thanks for your replay... still, I did not get it working.
I will try to give you a better explanation of my problem.
The panels are actually usercontrols. So I have 3 usercontrols among each other. I want to be able to change their heigth during runtime with something similar to a splitter. If one unsercontrol gets resized (e.g. heigth += 20), it affects the usercontrol next to it (in this case: height -= 20).
To be honest, I don't know where to start. Placing a splitter on the usercontrol doesn't do the trick. If you place your mouse over the splitter, it will change the Cursor to HSplit, but the events dont get fired.
I like your idea with just one event being fired by every splitter, but my problem at the moment is much more fundamental: where to place tose splitter.
Thanks for your help & time,
Dennis
|
|
|
|
|
I can't seem to think straight at the moment, so could anyone tell me why I am getting this error or how to get more information on it?
This is the error:
An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll
Additional information: System error.
This is the function:
private XmlDocument xd;
private XmlDocument tempdoc;
private void btnNewXML_Click(object sender, System.EventArgs e)
{
// Is a FLAPP directory selected?
if (CheckFLAPP(tboxFLAPP.Text) == true)
{
//create default xml document
tempdoc = new XmlDocument();
//load in generic document structure
tempdoc.LoadXml("<pens>" +
"<database id="" name="DATABASE">" +
"" +
"<column id="" name="PEN" min="" max="" color="" description="" aux1="" aux2="" bool1="" bool2="">" +
"" +
"<database>" +
"<pens>");
xd = new XmlDocument(); **ERROR OCCURS ON THIS LINE**
xd = tempdoc;
if(ValidateXmlDoc(xd))
{
DisplayInitXML(xd);
}
else
{
MessageBox.Show("The new xml document produced was invalid. Please contact ... for help.");
}
}
else
{
MessageBox.Show("You have not selected a FLAPP directory!");
}
}
Any help is appreciated.
alphanorm
|
|
|
|
|
Shouldn't that <table/> tag be </table>? Sometimes it helps when you pass valid XML to the LoadXML function : ).
|
|
|
|
|
OH SNAP!! Thanx fer the fresh set of eyes Brian. I think I need to sleep now.
alphanorm
|
|
|
|
|
I need to be able to display AOL .ART format files as well as the usual JPEG, GIF, etc. The VS.NET PictureBox does not support this format.
Does anyone have a suggest how this can be achieved?
Many thanks
Chris
|
|
|
|
|
Actually, GDI nor GDI+ (around which System.Drawing is built) does not natively support that format. You need a decoder that supports the .ART extension. I remember that IE a long time ago had this, but I'm not sure about it now.
If there's any hope for help, it would help to have an example. Could you post a .ART file up somewhere where I can take a look?
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]
|
|
|
|
|
Heath,
Thanks for replying to my post (again!!).
IE does indeed support AOL ART files, I played around with it some time ago (but can't find the code now!). It worked but I could only get it to work with a file as it's source. The code I have resizes images on the fly without writing out to a file - I couldn't work out how to get IE to accept anything other than a file.
Unfortunately any .art files I have are at work, and I am now at home for the weekend (Doh!). I'm scouting around the net to see if I can locate some, but putting .art into google gets the whole world back!
Chris
|
|
|
|
|
I found one in the first result with "AOL art image file". I'll need some time to take a look at how it is supported. GDI appears to support it but GDI+ doesn't "out of the box".
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]
|
|
|
|
|
Thanks for taking the time to look at this Heath.
|
|
|
|
|
Heath,
Did you ever get a chance to look at this? I put it on the 'back burner' to concentrate on other work, but have started looking at this again - any help would be appreciated, I can assure you it is in a good cause!
Chris
|
|
|
|
|
I did some originally but didn't find any answers. The best I can tell you is to go to http://lab.msdn.microsoft.com/vs2005[^] and request support for it in GDI+.
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]
|
|
|
|
|
Oh well, worth a try...
Thanks for your efforts!
If anyone else has any bright ideas for displaying .art files it would be appreciated.
|
|
|
|
|
I am trying to override the WM_PAINT message and I am continuously getting WM_PAINT messages. The basic code snippet is:
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PAINT)
{
Trace.WriteLine(" WM_PAINT event");
m.Result = IntPtr.Zero;
}
else
{
base.WndProc(ref m);
}
}
As I am planning to do all the drawing I don't want to call the base message processing for the WM_PAINT messages. Any ideas?
|
|
|
|
|
your code looks fine to me, could you be more specific about your problem?
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
I probablly should have mentioned that this is for a toolbar control that only contains buttons.. It seems that when I call the base message processing I only get the one WM_PAINT message (for instance when the cursor is dragged over a button). If I don't call the base message processing I constantly get WM_PAINT messages.
|
|
|
|
|
WM_PAINT methods are handled differently than other messages by Windows. A WM_PAINT message is automatically sent if there are any outstanding invalid regions in your window. Windows knows that have painted your window, and thus stop sending WM_PAINT, after an application calls the Win32 functions BeginPaint\EndPaint. The easiest way to accomplish this in your case is by calling the base class OnPaint, which handles it for you.
|
|
|
|
|
WM_PAINT is sent for many reasons, and the best way to optimize your code is to honor the PaintEventArgs.ClipBounds property passed to OnPaint . Only draw what's necessary.
Overriding WndProc to handle painting is almost never the right way to handle user painting. Instead, you call SetStyle in the constructor and override OnPaint like so:
public MyControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint,
true);
}
protected override void OnPaint(PaintEventArgs e)
{
} Control.WndProc already handles the WM_PAINT messages and wraps the arguments necessary for painting in the PaintEventArgs and disposes the Graphics object when OnPaint returns.
If you want double-buffering for your custom drawing code, also OR the ControlStyles.DoubleBuffer enumeration with SetStyle in the example source above.
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 all,
I need a program in C#.NET that can do compression and decompression of text files.
Will be much thankful, if u cud help me in getting the same.
Regards,
Manivannan.P
|
|
|
|
|
If depends what compression you want. The most popular is the ZIP format (LZH compression). The most popular ZIP library for .NET is #ziplib[^].
Note that .NET 2.0 will support LZH compression, as well as provide abstract stream classes for other stream compression algorithms.
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]
|
|
|
|
|
ok, so I made a tic tac toe game. But it's really of no use because you have to play against someone else and I don't even know how to have it tell if someone won. Basically I have flat buttons and every time one is clicked, it becomes read only and it it puts an X, and then the next button clicked has the text property of O and so on. I need help creating the code that enables the user to play against the computer. I think this is done using a two-dimensional array, but my skills in c-sharp are quite limited. So any help with the code and tactics the computer would use (in the form of code) would be very helpful. I realize this is kind of a big request, but if you have time, it would be awesome if you could help. You could even publish an article somewhere on the website, that many people would use.(just let me where you publish it if you do)
thank you so much,
Stephen
|
|
|
|
|
If you google for "tic tac toe bot", you'll find lots of discussions and examples in many different languages.
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]
|
|
|
|
|
Anyone have any ideea how to host other application in .net ? I start the word/notepad/cmd using process but i want my app to host it not the windows, something like mdi forms; when i minimize the hosted app i wanna go at base in my form not in windows.
Thanks in advance .
|
|
|
|
|
Don't know about notepda but ther are a lot of com components that you can use inside your own forms e.g. Windows media player.
If you are using visual studios then right click on the toolbar and select customize toolbar and you will get tons of com and .net components.
|
|
|
|