|
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace BorderControls
{
/// <summary>
/// Summary description for UserControl1.
/// </summary>
public class SimpleControl : System.Windows.Forms.UserControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public SimpleControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitComponent call
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label
//
this.label.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label.Location = new System.Drawing.Point(8, 16);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(48, 23);
this.label.TabIndex = 0;
this.label.Text = "Simple";
this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SimpleControl
//
this.Controls.Add(this.label);
this.Name = "SimpleControl";
this.Size = new System.Drawing.Size(64, 56);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label;
// Constant taken from WinUser.h
private const int WS_EX_CLIENTEDGE = 0x00000200;
// Provide window style constants to enable control border
protected override CreateParams CreateParams
{
get
{
CreateParams p = base.CreateParams; // Take the default params from the base class
p.ExStyle = p.ExStyle | WS_EX_CLIENTEDGE; // Add the extended "3d sunken border" style
return p;
}
}
}
}
|
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.
Jason Dorie is currently employed with Electronic Arts BlackBox in Vancouver, B.C. He does a variety of programming tasks including writing tools for creating games, 3D rendering, data and video compression, and data processing pipelines. He can often be found lurking on XBox live under the pseudonym "djMidnight".