Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by John
  • *Experts*
Posted

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?

Posted

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

  • *Experts*
Posted
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.
Posted

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

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...