[Mono-winforms-list] Splitter

Jonathan S. Chambers Jonathan.Chambers@ansys.com
Tue, 19 Apr 2005 15:12:46 -0400


This is a multi-part message in MIME format.

------_=_NextPart_001_01C54513.C57BD29B
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

	Here's an update. The resize bar is now drawn correctly (I
needed to set the Text and MinSize properties on the Form I display. Any
clue, anyone?). You still can't drag the splitter to the left as
described below.

-----Original Message-----
From: mono-winforms-list-admin@lists.ximian.com
[mailto:mono-winforms-list-admin@lists.ximian.com] On Behalf Of Jonathan
S. Chambers
Sent: Tuesday, April 19, 2005 10:22 AM
To: mono-winforms-list@lists.ximian.com
Cc: jackson@ximian.com
Subject: [Mono-winforms-list] Splitter

       I use the splitter in the property grid control, and made a few
changes to it. Most importantly, instead of resizing the controls as the
splitter is dragged, I display a bar on top of the controls (how MS SWF
does it) indicating the position and only resize the controls when the
mouse button is released. It works well running against .Net, but it has
a few idiosyncrasies with Mono.
      =20
1. In horizontal mode, the splitter works well except that the bar is
not drawing correctly (some sort of painting issue).
2. In vertical mode, the splitter works fine moving to the right, but
not to the left (when docked to the left). This appears to be a
MouseMove event issue though. When moving to the left past the original
position of the splitter, the mouse event args start out good (they
become negative), but after moving slightly to the left of the
splitter's original position, the mouse event args values become large
(63546 or some number like that, perhaps some sort of signed/unsigned
issue?).
3. There are some other smaller issues, but the control seems to behave
slightly better than before since it doesn't try to resize the controls
every time the mouse moves. (Drawing the bar indicating the position
took a while to figure out. On windows, MS probably gets the DC to the
desktop and draws on it. I know of no cross platform way to do that. I
tried handling the splitter's siblings paint event, and drawing the bar
on each control. That didn't work. Currently, I create a form with no
border and with a checkerboard pattern background. I move this with the
mouse moves)

It's not perfect, but it helped me in my work on the propertygrid. Give
it a try and let me know if you want me to check in the changes, etc.=20

- Jonathan




------_=_NextPart_001_01C54513.C57BD29B
Content-Type: application/octet-stream;
	name="Splitter.cs"
Content-Transfer-Encoding: base64
Content-Description: Splitter.cs
Content-Disposition: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