Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / Util / GroupLabel.cs / 1 / GroupLabel.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
// GroupLabel.cs
//
// 6/10/99: [....]: created
//
namespace System.Web.UI.Design.Util {
using System.Runtime.Serialization.Formatters;
using System.Diagnostics;
using System;
using System.Windows.Forms;
using System.Drawing;
///
///
/// A label control that draws an etched line beyond its text string
/// Do not use the AutoSize property with this control
///
///
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
internal sealed class GroupLabel : Label {
///
///
/// Creates a new GroupLabel
///
public GroupLabel() : base() {
SetStyle(ControlStyles.UserPaint, true);
}
///
///
/// Custom UI is painted here
///
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
Rectangle r = ClientRectangle;
string text = Text;
Brush foreBrush = new SolidBrush(ForeColor);
g.DrawString(text, Font, foreBrush, 0, 0);
foreBrush.Dispose();
int etchLeft = r.X;
if (text.Length != 0) {
Size sz = Size.Ceiling(g.MeasureString(text, Font));
etchLeft += 4 + sz.Width;
}
int etchTop = r.Height / 2;
g.DrawLine(SystemPens.ControlDark, etchLeft, etchTop, r.Width, etchTop);
etchTop++;
g.DrawLine(SystemPens.ControlLightLight, etchLeft, etchTop, r.Width, etchTop);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MonthCalendarDesigner.cs
- Knowncolors.cs
- SvcFileManager.cs
- Convert.cs
- InheritanceRules.cs
- ArrayList.cs
- SqlConnectionStringBuilder.cs
- VisualStyleRenderer.cs
- EntityDataSourceEntitySetNameItem.cs
- EventManager.cs
- ToggleButton.cs
- OleDbEnumerator.cs
- DocComment.cs
- ShimAsPublicXamlType.cs
- MD5.cs
- Exceptions.cs
- FrameworkElementFactory.cs
- SchemaImporterExtension.cs
- ValueQuery.cs
- PageContentAsyncResult.cs
- InternalBufferOverflowException.cs
- Binding.cs
- AutoScrollHelper.cs
- PageAsyncTaskManager.cs
- MultiBindingExpression.cs
- LogEntryHeaderDeserializer.cs
- XmlHierarchyData.cs
- NativeActivityContext.cs
- EntityDataSourceConfigureObjectContext.cs
- Pair.cs
- FactoryGenerator.cs
- ScalarOps.cs
- Mutex.cs
- MimeMultiPart.cs
- EndEvent.cs
- WindowsTokenRoleProvider.cs
- MethodCallTranslator.cs
- XmlAnyElementAttributes.cs
- ParseHttpDate.cs
- GradientBrush.cs
- PointLight.cs
- StylusPointPropertyInfoDefaults.cs
- UriParserTemplates.cs
- TimeSpan.cs
- EntityDataSourceColumn.cs
- ISAPIWorkerRequest.cs
- DynamicILGenerator.cs
- MsmqAppDomainProtocolHandler.cs
- OracleString.cs
- OutputCacheEntry.cs
- VirtualPath.cs
- UnaryNode.cs
- CannotUnloadAppDomainException.cs
- ExtendedPropertyCollection.cs
- TextBox.cs
- DataControlCommands.cs
- XmlDataLoader.cs
- ChtmlCalendarAdapter.cs
- WebUtil.cs
- UserPreferenceChangedEventArgs.cs
- List.cs
- EntityUtil.cs
- AlignmentXValidation.cs
- PointCollection.cs
- MatrixCamera.cs
- Model3D.cs
- LocalizabilityAttribute.cs
- GetWinFXPath.cs
- DocumentPageHost.cs
- CodePageEncoding.cs
- ResourceDescriptionAttribute.cs
- XMLUtil.cs
- RegionInfo.cs
- TreeNodeConverter.cs
- Types.cs
- ValueProviderWrapper.cs
- Merger.cs
- SafeRightsManagementSessionHandle.cs
- WindowsSlider.cs
- JapaneseLunisolarCalendar.cs
- Expression.cs
- TaskDesigner.cs
- DropDownList.cs
- SqlUdtInfo.cs
- CharKeyFrameCollection.cs
- InstanceDataCollection.cs
- ProcessModule.cs
- ThousandthOfEmRealDoubles.cs
- HostingEnvironment.cs
- FormsAuthenticationModule.cs
- XmlElementAttributes.cs
- DrawingState.cs
- DataGridViewSelectedColumnCollection.cs
- SemanticTag.cs
- OutputCacheSection.cs
- XmlSerializerNamespaces.cs
- ProvidePropertyAttribute.cs
- PathGeometry.cs
- ClientData.cs
- FixedFlowMap.cs