|
|
Nice job. I like your Collapsible Splitter. May I use it in my commercial application?
|
|
|
|
|
it would be nice if you could update Collapsible Splitter control to the newest version
|
|
|
|
|
use Dispose!!! (override Dispose, dispose graphic objects ...)
|
|
|
|
|
This is a fix for lack of dispose in OnPaint
protected override void OnPaint(PaintEventArgs e)
{
using (Graphics g = e.Graphics)
{
Pen pen_controlLightLight = new Pen(SystemColors.ControlLightLight);
Pen pen_controlLight = new Pen(SystemColors.ControlLight);
Pen pen_controlDark = new Pen(SystemColors.ControlDark);
Pen pen_backColor = new Pen(this.BackColor);
Pen pen_hotColor = new Pen(this.hotColor);
Pen pen_controlDarkDark = new Pen(SystemColors.ControlDarkDark);
Brush brush_controlDark = new SolidBrush(SystemColors.ControlDark);
Brush brush_controlDarkDark = new SolidBrush(SystemColors.ControlDarkDark);
Brush brush_backColor = new SolidBrush(this.BackColor);
Brush brush_hotColor = new SolidBrush(this.hotColor);
Rectangle r = this.ClientRectangle;
g.FillRectangle(brush_backColor, r);
#region Vertical Splitter
if (this.Dock == DockStyle.Left || this.Dock == DockStyle.Right)
{
rr = new Rectangle(r.X, (int)r.Y + ((r.Height - 115) / 2), 8, 115);
this.Width = 8;
if (hot)
{
g.FillRectangle(brush_hotColor, new Rectangle(rr.X + 1, rr.Y, 6, 115));
}
else
{
g.FillRectangle(brush_backColor, new Rectangle(rr.X + 1, rr.Y, 6, 115));
}
using (Pen pn = new Pen(SystemColors.ControlDark, 1))
{
g.DrawLine(pn, rr.X + 1, rr.Y, rr.X + rr.Width - 2, rr.Y);
g.DrawLine(pn, rr.X + 1, rr.Y + rr.Height, rr.X + rr.Width - 2, rr.Y + rr.Height);
}
if (this.Enabled)
{
g.FillPolygon(brush_controlDarkDark, ArrowPointArray(rr.X + 2, rr.Y + 3));
g.FillPolygon(brush_controlDarkDark, ArrowPointArray(rr.X + 2, rr.Y + rr.Height - 9));
}
int x = rr.X + 3;
int y = rr.Y + 14;
switch (visualStyle)
{
case VisualStyles.Mozilla:
for (int i = 0; i < 30; i++)
{
g.DrawLine(pen_controlLightLight, x, y + (i * 3), x + 1, y + 1 + (i * 3));
g.DrawLine(pen_controlDarkDark, x + 1, y + 1 + (i * 3), x + 2, y + 2 + (i * 3));
if (hot)
{
g.DrawLine(pen_hotColor, x + 2, y + 1 + (i * 3), x + 2, y + 2 + (i * 3));
}
else
{
g.DrawLine(pen_backColor, x + 2, y + 1 + (i * 3), x + 2, y + 2 + (i * 3));
}
}
break;
case VisualStyles.DoubleDots:
for (int i = 0; i < 30; i++)
{
g.DrawRectangle(pen_controlLightLight, x, y + 1 + (i * 3), 1, 1);
g.DrawRectangle(pen_controlDark, x - 1, y + (i * 3), 1, 1);
i++;
g.DrawRectangle(pen_controlLightLight, x + 2, y + 1 + (i * 3), 1, 1);
g.DrawRectangle(pen_controlDark, x + 1, y + (i * 3), 1, 1);
}
break;
case VisualStyles.Win9x:
g.DrawLine(pen_controlLightLight, x, y, x + 2, y);
g.DrawLine(pen_controlLightLight, x, y, x, y + 90);
g.DrawLine(pen_controlDark, x + 2, y, x + 2, y + 90);
g.DrawLine(pen_controlDark, x, y + 90, x + 2, y + 90);
break;
case VisualStyles.XP:
for (int i = 0; i < 18; i++)
{
g.DrawRectangle(pen_controlLight, x, y + (i * 5), 2, 2);
g.DrawRectangle(pen_controlLightLight, x + 1, y + 1 + (i * 5), 1, 1);
g.DrawRectangle(pen_controlDarkDark, x, y + (i * 5), 1, 1);
g.DrawLine(pen_controlDark, x, y + (i * 5), x, y + (i * 5) + 1);
g.DrawLine(pen_controlDark, x, y + (i * 5), x + 1, y + (i * 5));
}
break;
case VisualStyles.Lines:
for (int i = 0; i < 44; i++)
{
g.DrawLine(pen_controlDark, x, y + (i * 2), x + 2, y + (i * 2));
}
break;
}
if (this.borderStyle != System.Windows.Forms.Border3DStyle.Flat)
{
ControlPaint.DrawBorder3D(e.Graphics, this.ClientRectangle, this.borderStyle, Border3DSide.Left);
ControlPaint.DrawBorder3D(e.Graphics, this.ClientRectangle, this.borderStyle, Border3DSide.Right);
}
}
#endregion
#region Horizontal Splitter
else if (this.Dock == DockStyle.Top || this.Dock == DockStyle.Bottom)
{
rr = new Rectangle((int)r.X + ((r.Width - 115) / 2), r.Y, 115, 8);
this.Height = 8;
if (hot)
{
g.FillRectangle(brush_hotColor, new Rectangle(rr.X, rr.Y + 1, 115, 6));
}
else
{
g.FillRectangle(brush_backColor, new Rectangle(rr.X, rr.Y + 1, 115, 6));
}
using (Pen pn = new Pen(SystemColors.ControlDark, 1))
{
g.DrawLine(pn, rr.X, rr.Y + 1, rr.X, rr.Y + rr.Height - 2);
g.DrawLine(pn, rr.X + rr.Width, rr.Y + 1, rr.X + rr.Width, rr.Y + rr.Height - 2);
}
if (this.Enabled)
{
g.FillPolygon(brush_controlDarkDark, ArrowPointArray(rr.X + 3, rr.Y + 2));
g.FillPolygon(brush_controlDarkDark, ArrowPointArray(rr.X + rr.Width - 9, rr.Y + 2));
}
int x = rr.X + 14;
int y = rr.Y + 3;
switch (visualStyle)
{
case VisualStyles.Mozilla:
for (int i = 0; i < 30; i++)
{
g.DrawLine(pen_controlLightLight, x + (i * 3), y, x + 1 + (i * 3), y + 1);
g.DrawLine(pen_controlDarkDark, x + 1 + (i * 3), y + 1, x + 2 + (i * 3), y + 2);
if (hot)
{
g.DrawLine(pen_hotColor, x + 1 + (i * 3), y + 2, x + 2 + (i * 3), y + 2);
}
else
{
g.DrawLine(pen_backColor, x + 1 + (i * 3), y + 2, x + 2 + (i * 3), y + 2);
}
}
break;
case VisualStyles.DoubleDots:
for (int i = 0; i < 30; i++)
{
g.DrawRectangle(pen_controlLightLight, x + 1 + (i * 3), y, 1, 1);
g.DrawRectangle(pen_controlDark, x + (i * 3), y - 1, 1, 1);
i++;
g.DrawRectangle(pen_controlLightLight, x + 1 + (i * 3), y + 2, 1, 1);
g.DrawRectangle(pen_controlDark, x + (i * 3), y + 1, 1, 1);
}
break;
case VisualStyles.Win9x:
g.DrawLine(pen_controlLightLight, x, y, x, y + 2);
g.DrawLine(pen_controlLightLight, x, y, x + 88, y);
g.DrawLine(pen_controlDark, x, y + 2, x + 88, y + 2);
g.DrawLine(pen_controlDark, x + 88, y, x + 88, y + 2);
break;
case VisualStyles.XP:
for (int i = 0; i < 18; i++)
{
g.DrawRectangle(pen_controlLight, x + (i * 5), y, 2, 2);
g.DrawRectangle(pen_controlLightLight, x + 1 + (i * 5), y + 1, 1, 1);
g.DrawRectangle(pen_controlDarkDark, x + (i * 5), y, 1, 1);
g.DrawLine(pen_controlDark, x + (i * 5), y, x + (i * 5) + 1, y);
g.DrawLine(pen_controlDark, x + (i * 5), y, x + (i * 5), y + 1);
}
break;
case VisualStyles.Lines:
for (int i = 0; i < 44; i++)
{
g.DrawLine(pen_controlDark, x + (i * 2), y, x + (i * 2), y + 2);
}
break;
}
if (this.borderStyle != System.Windows.Forms.Border3DStyle.Flat)
{
ControlPaint.DrawBorder3D(e.Graphics, this.ClientRectangle, this.borderStyle, Border3DSide.Top);
ControlPaint.DrawBorder3D(e.Graphics, this.ClientRectangle, this.borderStyle, Border3DSide.Bottom);
}
}
#endregion
else
{
throw new Exception("The Collapsible Splitter control cannot have the Filled or None Dockstyle property");
}
pen_controlLightLight.Dispose();
pen_controlLight.Dispose();
pen_controlDark.Dispose();
pen_backColor.Dispose();
pen_hotColor.Dispose();
pen_controlDarkDark.Dispose();
brush_controlDark.Dispose();
brush_controlDarkDark.Dispose();
brush_backColor.Dispose();
brush_hotColor.Dispose();
}
}
|
|
|
|
|
Very usefull, and I want to use it in my project.
To be fankly, it do exists a memory-leak problem in the OnPaint method. I also encountered such kind of problem before. An experienced programmer told me that all graphic object(Pen, Brush, Font and what not) need to be disposed.
|
|
|
|
|
This is only true if you create the Graphics object using Graphics.FromXxxxx()
|
|
|
|
|
Hi, I have been tryied to implement a similar component when I lock your. So I get some methods from our implementation but inheriting from SplitterContainer. I want to know if I can do a article discribing the changes that I made based on your component a submite the source code for other developers.
Mário Santos, Brazil.
|
|
|
|
|
So long as you link back to this article, go for it Mário.
|
|
|
|
|
Thanks a lot for this control! It's really nice (although it seems like it should still work like a normal splitter when the control to collapse is not set -- I wanted it originally just for the improved look).
One thing: the Interval property of the animation timer is only set in the constructor, so setting the AnimationDelay property does nothing. Add the following line in the set accessor of AnimationDelay:
animationTimer.Interval = value;
Still, it doesn't change much to go shorter than the default of 20 due to the timer resolution, and I doubt anyone is going to want to make it longer (more choppy motion).
|
|
|
|
|
It should set "this.animationTimer.Interval = value;" in the Property of AnimationDelay
Thus it looks like follows:
[Bindable(true), Category("Collapsing Options"), DefaultValue("20"),
Description("The delay in millisenconds between animation steps")]
public int AnimationDelay
{
get { return this.animationDelay; }
set { this.animationDelay = value; this.animationTimer.Interval = value; }
}
|
|
|
|
|
Can I use a button to do open/close the panels or do I have to use the toolbar? If I can use the button, how would I code it? This is my first time using c and I need all the help I can get.
Thanks
|
|
|
|
|
Hi,
We have integrated the collapsible splitter into our application. It worked fine under .NET 1.1 but we now have issues with it under 2.0. The problem seems random as we can't find a pattern to reproduce it. It even happens when the form with the splitter in it is minimized. We sometimes get the following error message when the splitter paints itself.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Drawing.SafeNativeMethods.Gdip.GdipDrawLineI(HandleRef graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
at CollapsibleSplitter.OnPaint(PaintEventArgs e) in C:\DEV\APTS\NJFLib.Controls\NJFLib.Controls.CollapsibleSplitter.cs:line 601
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run()
Any ideas on why this happen?
|
|
|
|
|
|
For example,I have a treeview docked in the left which is the hide control of the Collapsible Splitter control "CollapsibleSplitter1". Then it works well. But now I want to hide the ChildForm, and expand the threeview. How should I do?
|
|
|
|
|
you know, sometimes we need to update other UI elements when the splitter folded or unfolded, but i found no event notification was raised when the state toggled in this control. then i added one by myself, which is very simple.
i'm fresh here, so i dont know how to post code or upload attachment package who can help me to post my modification? thanks
|
|
|
|
|
Hi
I think you have a problem in your code, because in the demo exe, every time we use your splitter in the exe the memory usage increase(you can monitor the memory usage with windows task manager)
I think your allocate variables without deallocation..
kanaan
|
|
|
|
|
Furty - nice control and I have things working pretty much the way I want except that when I collapse your splitter to the right edge of a tabPage (this splitter hides panel4 docked to the right side) I no longer can see the splitter. I have a collapsible splitter on the left side (hidding panel1 docked to the left) and a splitter on the top (this hides panel2) and they work fine.
Any idea why the right side is giving me problems?
The app is a Form with a tabSheet and two tab pages. The second tab page is where the collapsible splitters are and the four panes:
panel2
panel1 VCS HCS VCS panel4
panel3
Thanks.
Jon.
|
|
|
|
|
Hi Jon,
It sounds like you've got the second VCS as a child of Panel4, rather than a child of the TabPage itself. Failing this, it could be a z-order issue.
As noted in this[^] thread, all such issues usually end up being a simple heirarchy problem.
|
|
|
|
|
When we put the splitter on a form, it works as expected. However, when we put it on a custom control (or standard panel), it has problems. It correctly draws itself, and correctly hides/shows the "controlToHide". However, the location of the splitter does not move. When we place everything on a Panel, it moves, but the "dark gray" outline of the "old" position remains. Our guess is that there is a bunch of extra processing that occurs behind the scenes on the Form vs. a control. Any ideas on how we might get this to work correctly? Thanks.
|
|
|
|
|
Yeah! I met the same problem:
Please allow me to use the term "Shadow" to describe the stuff which I really didn't know how to name it. The term "Shadow" is: When you press the splitter( don't release you mouse ) or drag the splitter, you can see a "Shadow" which helps to identify the position of the splitter.
----------------------------------------------
OK, here is the issue:
1, I set the UseAnimation to "False", Mozila style and run the application.
2, When I click the splitter, everything is OK except the "Shadow" still left.
3, And I replace your splitter with .Net 2.0's. The sistuation still happens. So I think it's Windows's fault.
Release PunCha's Power!
|
|
|
|
|
I think it's splitter's bug. i also met this shadow when using splitter with user control in panel. anyone please help
|
|
|
|
|
It appears you can't drag/resize the splitter by attempting to "grab" the splitter button. The button only allows clicking to hide a control. It would be nice to allow re-sizing as well but didn't find a way.
|
|
|
|
|
You can made the following changes to the member function OnMouseDown:
protected override void OnMouseDown(MouseEventArgs e)
{
if (this.controlToHide != null)
{
if ( this.controlToHide.Visible)
{
base.OnMouseDown(e);
}
}
}
Release PunCha's Power!
|
|
|
|
|
I added offscreen drawing to OnPaint. At times I could see the individual dots being drawn
Other than that great control and thanks!
t
relavent code
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
Graphics g = e.Graphics;<br />
<br />
Bitmap b = new Bitmap(ClientRectangle.Width,<br />
ClientRectangle.Height);<br />
Graphics bg = Graphics.FromImage(b);<br />
bg.Clear(this.BackColor);<br />
<br />
Rectangle r = this.ClientRectangle;
<br />
#region Vertical Splitter<br />
if(this.Dock == DockStyle.Left || this.Dock == DockStyle.Right)<br />
{<br />
rr = new Rectangle(r.X, (int)r.Y + ((r.Height - 115)/2), 8, 115);<br />
this.Width = 8;<br />
<br />
if(hot)<br />
{<br />
bg.FillRectangle(new SolidBrush(hotColor), new Rectangle(rr.X + 1, rr.Y, 6, 115));<br />
}<br />
else<br />
{<br />
bg.FillRectangle(new SolidBrush(this.BackColor), new Rectangle(rr.X + 1, rr.Y, 6, 115));<br />
}<br />
<br />
bg.DrawLine(new Pen(SystemColors.ControlDark, 1), rr.X + 1, rr.Y, rr.X + rr.Width - 2, rr.Y);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark, 1), rr.X + 1, rr.Y + rr.Height, rr.X + rr.Width - 2, rr.Y + rr.Height);<br />
<br />
if(this.Enabled)<br />
{<br />
bg.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), ArrowPointArray(rr.X + 2, rr.Y + 3));<br />
bg.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), ArrowPointArray(rr.X + 2, rr.Y + rr.Height - 9));<br />
}<br />
<br />
int x = rr.X + 3;<br />
int y = rr.Y + 14;<br />
<br />
switch(visualStyle)<br />
{<br />
case VisualStyles.Mozilla:<br />
<br />
for(int i=0; i < 30; i++)<br />
{<br />
bg.DrawLine(new Pen(SystemColors.ControlLightLight), x, y + (i*3), x+1, y + 1 + (i*3));<br />
bg.DrawLine(new Pen(SystemColors.ControlDarkDark), x+1, y + 1 + (i*3), x+2, y + 2 + (i*3));<br />
if(hot)<br />
{<br />
bg.DrawLine(new Pen(hotColor), x+2, y + 1 + (i*3), x+2, y + 2 + (i*3));<br />
}<br />
else<br />
{<br />
bg.DrawLine(new Pen(this.BackColor), x+2, y + 1 + (i*3), x+2, y + 2 + (i*3));<br />
}<br />
}<br />
break;<br />
<br />
case VisualStyles.DoubleDots:<br />
for(int i=0; i < 30; i++)<br />
{<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLightLight), x, y + 1 + (i*3), 1, 1 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlDark), x - 1, y +(i*3), 1, 1 );<br />
i++;<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLightLight), x + 2, y + 1 + (i*3), 1, 1 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlDark), x + 1, y + (i*3), 1, 1 );<br />
}<br />
break;<br />
<br />
case VisualStyles.Win9x:<br />
<br />
bg.DrawLine(new Pen(SystemColors.ControlLightLight), x, y, x + 2, y);<br />
bg.DrawLine(new Pen(SystemColors.ControlLightLight), x, y, x,y + 90);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x + 2, y, x + 2, y + 90);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x, y + 90, x + 2, y + 90);<br />
break;<br />
<br />
case VisualStyles.XP:<br />
<br />
for(int i=0; i < 18; i++)<br />
{<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLight), x, y + (i*5), 2, 2 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLightLight), x + 1, y + 1 + (i*5), 1, 1 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlDarkDark), x, y +(i*5), 1, 1 );<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x, y + (i*5), x, y + (i*5) + 1);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x, y + (i*5), x + 1, y + (i*5));<br />
}<br />
break;<br />
<br />
case VisualStyles.Lines:<br />
<br />
for(int i=0; i < 44; i++)<br />
{<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x, y + (i*2), x + 2, y + (i*2));<br />
}<br />
<br />
break;<br />
}<br />
<br />
if(this.borderStyle != System.Windows.Forms.Border3DStyle.Flat)<br />
{<br />
ControlPaint.DrawBorder3D(bg, this.ClientRectangle, this.borderStyle, Border3DSide.Left);<br />
ControlPaint.DrawBorder3D(bg, this.ClientRectangle, this.borderStyle, Border3DSide.Right);<br />
}<br />
}<br />
<br />
#endregion<br />
<br />
<br />
#region Horizontal Splitter<br />
<br />
else if (this.Dock == DockStyle.Top || this.Dock == DockStyle.Bottom)<br />
{<br />
rr = new Rectangle((int)r.X + ((r.Width - 115)/2), r.Y, 115, 8);<br />
this.Height = 8;<br />
<br />
if(hot)<br />
{<br />
bg.FillRectangle(new SolidBrush(hotColor), new Rectangle(rr.X, rr.Y + 1, 115, 6));<br />
}<br />
else<br />
{<br />
bg.FillRectangle(new SolidBrush(this.BackColor), new Rectangle(rr.X, rr.Y + 1, 115, 6));<br />
}<br />
<br />
bg.DrawLine(new Pen(SystemColors.ControlDark, 1), rr.X, rr.Y + 1, rr.X, rr.Y + rr.Height - 2);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark, 1), rr.X + rr.Width, rr.Y + 1, rr.X + rr.Width, rr.Y + rr.Height - 2);<br />
<br />
if(this.Enabled)<br />
{<br />
bg.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), ArrowPointArray(rr.X + 3, rr.Y + 2));<br />
bg.FillPolygon(new SolidBrush(SystemColors.ControlDarkDark), ArrowPointArray(rr.X + rr.Width - 9, rr.Y + 2));<br />
}<br />
<br />
int x = rr.X + 14;<br />
int y = rr.Y + 3;<br />
<br />
switch(visualStyle)<br />
{<br />
case VisualStyles.Mozilla:<br />
<br />
for(int i=0; i < 30; i++)<br />
{<br />
bg.DrawLine(new Pen(SystemColors.ControlLightLight), x + (i*3), y, x + 1 + (i*3), y + 1);<br />
bg.DrawLine(new Pen(SystemColors.ControlDarkDark), x + 1 + (i*3), y + 1, x + 2 + (i*3), y + 2);<br />
if(hot)<br />
{<br />
bg.DrawLine(new Pen(hotColor), x + 1 + (i*3), y + 2, x + 2 + (i*3), y + 2);<br />
}<br />
else<br />
{<br />
bg.DrawLine(new Pen(this.BackColor), x + 1 + (i*3), y + 2, x + 2 + (i*3), y + 2);<br />
}<br />
}<br />
break;<br />
<br />
case VisualStyles.DoubleDots:<br />
<br />
for(int i=0; i < 30; i++)<br />
{<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLightLight), x + 1 + (i*3), y, 1, 1 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlDark), x + (i*3), y - 1, 1, 1 );<br />
i++;<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLightLight), x + 1 + (i*3), y + 2, 1, 1 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlDark), x + (i*3), y + 1, 1, 1 );<br />
}<br />
break;<br />
<br />
case VisualStyles.Win9x:<br />
<br />
bg.DrawLine(new Pen(SystemColors.ControlLightLight), x, y, x, y + 2);<br />
bg.DrawLine(new Pen(SystemColors.ControlLightLight), x, y, x + 88, y);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x, y + 2, x + 88, y + 2);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x + 88, y, x + 88, y + 2);<br />
break;<br />
<br />
case VisualStyles.XP:<br />
<br />
for(int i=0; i < 18; i++)<br />
{<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLight), x + (i*5), y, 2, 2 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlLightLight), x + 1 + (i*5), y + 1, 1, 1 );<br />
bg.DrawRectangle(new Pen(SystemColors.ControlDarkDark), x +(i*5), y, 1, 1 );<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x + (i*5), y, x + (i*5) + 1, y);<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x + (i*5), y, x + (i*5), y + 1);<br />
}<br />
break;<br />
<br />
case VisualStyles.Lines:<br />
<br />
for(int i=0; i < 44; i++)<br />
{<br />
bg.DrawLine(new Pen(SystemColors.ControlDark), x + (i*2), y, x + (i*2), y + 2);<br />
}<br />
<br />
break;<br />
}<br />
<br />
if(this.borderStyle != System.Windows.Forms.Border3DStyle.Flat)<br />
{<br />
ControlPaint.DrawBorder3D(bg, this.ClientRectangle, this.borderStyle, Border3DSide.Top);<br />
ControlPaint.DrawBorder3D(bg, this.ClientRectangle, this.borderStyle, Border3DSide.Bottom);<br />
}<br />
}<br />
<br />
#endregion<br />
<br />
else<br />
{<br />
throw new Exception("The Collapsible Splitter control cannot have the Filled or None Dockstyle property");<br />
}<br />
<br />
<br />
g.DrawImage(b, 0, 0);<br />
<br />
bg.Dispose();<br />
b.Dispose();<br />
<br />
g.Dispose();<br />
}<br />
|
|
|
|
|