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
- OutputCacheSettingsSection.cs
- Visual.cs
- FragmentQueryProcessor.cs
- HttpCacheParams.cs
- DataSet.cs
- Vector3DIndependentAnimationStorage.cs
- Window.cs
- MenuTracker.cs
- ViewStateAttachedPropertyFeature.cs
- CookieParameter.cs
- DataBinding.cs
- HtmlTernaryTree.cs
- Location.cs
- ExecutorLocksHeldException.cs
- PropertyConverter.cs
- PrintingPermission.cs
- ThreadStartException.cs
- FormViewDeletedEventArgs.cs
- NonSerializedAttribute.cs
- GridView.cs
- RectAnimationClockResource.cs
- RealizationDrawingContextWalker.cs
- OdbcConnectionOpen.cs
- MatrixValueSerializer.cs
- Command.cs
- Stack.cs
- MetadataUtil.cs
- SectionRecord.cs
- InvokeHandlers.cs
- ConfigXmlDocument.cs
- ISFClipboardData.cs
- TransactionScopeDesigner.cs
- Baml6Assembly.cs
- BamlRecordWriter.cs
- UrlPath.cs
- XmlSchemaException.cs
- GCHandleCookieTable.cs
- TraceFilter.cs
- TransactionBehavior.cs
- MetadataSerializer.cs
- relpropertyhelper.cs
- AssemblyUtil.cs
- MbpInfo.cs
- GetPageCompletedEventArgs.cs
- TypedLocationWrapper.cs
- VScrollBar.cs
- XmlAttributes.cs
- Decoder.cs
- BitmapEffectState.cs
- DebugControllerThread.cs
- ScaleTransform3D.cs
- JavaScriptObjectDeserializer.cs
- BlurEffect.cs
- XhtmlBasicLiteralTextAdapter.cs
- IntranetCredentialPolicy.cs
- PartitionedDataSource.cs
- PackUriHelper.cs
- DataFieldConverter.cs
- BasicViewGenerator.cs
- UncommonField.cs
- oledbconnectionstring.cs
- xdrvalidator.cs
- LinearGradientBrush.cs
- CodeCommentStatement.cs
- ExpressionCopier.cs
- XmlAttribute.cs
- BindingsCollection.cs
- ChannelDemuxer.cs
- NameNode.cs
- QilInvokeLateBound.cs
- BadImageFormatException.cs
- StaticFileHandler.cs
- DataGridViewRow.cs
- ErrorWebPart.cs
- Camera.cs
- TextSelectionHighlightLayer.cs
- NameTable.cs
- SelectionUIHandler.cs
- DelimitedListTraceListener.cs
- LZCodec.cs
- Frame.cs
- PersonalizableTypeEntry.cs
- XmlDomTextWriter.cs
- HttpApplicationFactory.cs
- WebPartZoneBaseDesigner.cs
- EnumMemberAttribute.cs
- __Filters.cs
- UnsafeNativeMethods.cs
- Lock.cs
- XXXInfos.cs
- CompilerTypeWithParams.cs
- MetadataAssemblyHelper.cs
- ResourceDictionaryCollection.cs
- ElementMarkupObject.cs
- ValidatorCollection.cs
- CompilationAssemblyInstallComponent.cs
- Splitter.cs
- Padding.cs
- Vector3DCollectionConverter.cs
- XmlAttributeOverrides.cs