- machatproject.zip
- MaChatproject
- Chat.sln
- Chat.suo
- ChatLibrary
- MaChat
- MagicLibrary
- AssemblyInfo.cs
- bin
- Debug
- Release
- Collections
- Common
- Controls
- Docking
- MagicLibrary.csproj
- MagicLibrary.csproj.user
- Menus
- obj
- Debug
- MagicLibrary.projdata
- temp
- TempPE
- Release
- MagicLibrary.projdata
- temp
- TempPE
- Resources
- ImagesCaptionIDE.bmp
- ImagesCaptionPlain.bmp
- ImagesMenuControl.bmp
- ImagesPopupMenu.bmp
- ImagesTabControl.bmp
- LibraryIcon.ico
- Win32
- Resources
- bin
- MaChat.ChatProxy.pl.resX
- MaChat.ChatProxy.resX
- MaChat.MainForm.pl.resX
- MaChat.MainForm.resX
- MaChat.OptionsDlg.pl.resX
- MaChat.OptionsDlg.resX
- obj
- Resources.vcproj
- Setup
- Setup.vdproj
- Setup
- ssetup.zip
- sSetup.msi
- lsetup.zip
- lSetup.msi
|
// *****************************************************************************
//
// (c) Crownwood Consulting Limited 2002
// All rights reserved. The software and associated documentation
// supplied hereunder are the proprietary information of Crownwood Consulting
// Limited, Haxey, North Lincolnshire, England and are supplied subject to
// licence terms.
//
// Magic Version 1.6 www.dotnetmagic.com
// *****************************************************************************
using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Crownwood.Magic.Controls
{
[ToolboxItem(false)]
public class BorderForControl : UserControl
{
// Instance fields
protected int _borderWidth = 2;
public BorderForControl()
{
InternalConstruct(null, _borderWidth);
}
public BorderForControl(Control control)
{
InternalConstruct(control, _borderWidth);
}
public BorderForControl(Control control, int borderWidth)
{
InternalConstruct(control, borderWidth);
}
protected void InternalConstruct(Control control, int borderWidth)
{
// Remember parameter
_borderWidth = borderWidth;
if (control != null)
{
// Remove any existing docking style for passed in Control
control.Dock = DockStyle.None;
// Add to appearance
Controls.Add(control);
}
}
public int BorderWidth
{
get { return _borderWidth; }
set { _borderWidth = value; }
}
protected override void OnResize(EventArgs e)
{
ResizeOnlyTheChild();
base.OnResize(e);
}
protected override void OnLayout(LayoutEventArgs e)
{
ResizeOnlyTheChild();
base.OnLayout(e);
}
protected void ResizeOnlyTheChild()
{
// Do we have a child control to resize?
if (Controls.Count >= 1)
{
Size ourSize = this.Size;
// Get the first child (there should not be any others)
Control child = this.Controls[0];
// Define new position
child.Location = new Point(_borderWidth, _borderWidth);
// Define new size
child.Size = new Size(ourSize.Width - _borderWidth * 2, ourSize.Height - _borderWidth * 2);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Micheal is an independent consultant -
www.macmichal.pl.
He's main areas of interest are: DDD\CqRS, TDD, SaaS, Design Patterns, Architecture. He specializes in .Net/C# for the early beginning of it and T-SQL. He's a writer, blogger (
blog.macmichal.pl) and speaker.
In his spare time, he's climbing the mountains all over the Europe.