pjv Posted August 20, 2003 Posted August 20, 2003 (edited) Hi folks, Some background: I'm trying to develop a c# version of the dynamic sash window control from wxWindows, which you can see here: http://matt.kimball.net/sash/ I decided to start by creating a SplitView class (inheriting from Control) that would provide the two scrollbars (standard windows forms controls) and draw the two sashes. These would be drawn at the top of the vertical scrollbar and to the left of the horizontal scrollbar (drawn in the OnPaint method). I Successfully added code to drag a splitter type line down and fire an event when the mouse was released. I then created a second class (SplitWindow) to wrap the first and do the actual splitting. At the moment it simply contains references to two SplitView's, one of which is DockStyle.Fill to begin with. When a split event is received for that first SplitView it changes the dock property, adds the second control and adds a Splitter control between them. When the split event is fired the form seems to split okay, the two SplitViews appear to be the correct size. (More complex functionality was going to be added after I had one split working :) ). Problem part: Unfortunately, the Splitter control appears to be invisible (it works but cannot be seen). Also, the sashes do not seem to display properly, some resizing of the form revealed the sash from the vertical scrollbar much lower down than it should be (see bottom left of the included screen shot). In fact it appears to be shifted down the form roughly the height of the top SplitView (the top one displays correctly). Also, mouse events do not seem to be processed by the second SplitView, they all seem to go through the first one. I have included my code, and exe and a jpg of the problem, can anyone see what I'm doing wrong? Thanks for any help you can provide, Pete [edit]Removed binary from zip file. Please don't post binaries in attatchments, thanks - Orbity[/edit]dynsplit.zip Edited August 20, 2003 by John Quote
*Experts* Volte Posted August 20, 2003 *Experts* Posted August 20, 2003 The Splitter bar *is* invisible, unless you set the borderstyle. There's nothing to show. The only reason it sometimes looks 3D is that there are two sunken controls on either side of it. Other than that, I don't know what you mean be the mouse-events are only processed by the first one. Can you give an example of this functionality? Quote
pjv Posted August 20, 2003 Author Posted August 20, 2003 But I -am- setting the borderstyle (to fixed3d). Take a look at the demo for an example. Basically I cannot make the mouse wheel scroll the second SplitView. To get the second view, move the mouse over the dark grey thing at the top of the vertical scrollbar and drag it down to about halfway. The main problem I'm having is that the sash doesn't display correctly for the second splitview.. Of course.. this might have more to do with gdi+ (used to draw the sash) than windows forms (does the splitting), it's hard to tell. The sash is drawn based on the Top, Left, etc properties of the control. This would seem to indicate that they are incorrect for the second splitview, except that it otherwise (scrollbars) displays okay. Pete Quote
*Experts* Volte Posted August 20, 2003 *Experts* Posted August 20, 2003 You'll need to repost the demo project as code files rather than a binary, since that is against the rules and it was removed by a moderator. Quote
pjv Posted August 20, 2003 Author Posted August 20, 2003 I posted a zip with a binary, a source code file and a picture of the problem. It appears only the binary was removed so the file should be okay. Pete Quote
pjv Posted August 20, 2003 Author Posted August 20, 2003 Okay I fixed it.. for those that are interested (talking to myself again :) ) I was using Control.Left where I should have been using Control.ClientRectangle.Left. D'oh! Still can't get those mouse events to work on the second splitview though.. I guess that within the SplitWindow container the first splitview must have focus? Also does anyone know how to get the same style of line as Splitter uses when dragging it? I've tried some of the different HatchBrush styles, but I can't quite seem to get it. Pete Quote
*Gurus* divil Posted August 21, 2003 *Gurus* Posted August 21, 2003 You have to use interop to create a hatched brush that looks like the one the splitter uses - if this is what you're trying to do, I have some C# code from my dockable windows suite that you can have, if you like. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
pjv Posted August 21, 2003 Author Posted August 21, 2003 That would be very helpful, thank you. Can you post it here, or would you prefer to email? (pvidler at gawab dot com) Thanks again, Pete Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.