Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / PanelDesigner.cs / 1 / PanelDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.Design { using System.ComponentModel; using System.Diagnostics; using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; using Microsoft.Win32; using System.Windows.Forms.Design.Behavior; ////// /// This class handles all design time behavior for the panel class. This /// draws a visible border on the panel if it doesn't have a border so the /// user knows where the boundaries of the panel lie. /// internal class PanelDesigner : ScrollableControlDesigner { public PanelDesigner() { AutoResizeHandles = true; } ////// /// This draws a nice border around our panel. We need /// this because the panel can have no border and you can't /// tell where it is. /// ///protected virtual void DrawBorder(Graphics graphics) { Panel panel = (Panel)Component; // if the panel is invisible, bail now if(panel == null || !panel.Visible) { return; } Pen pen = BorderPen; Rectangle rc = Control.ClientRectangle; rc.Width --; rc.Height--; graphics.DrawRectangle(pen, rc); pen.Dispose(); } /// /// /// Overrides our base class. Here we check to see if there /// is no border on the panel. If not, we draw one so that /// the panel shape is visible at design time. /// protected override void OnPaintAdornments(PaintEventArgs pe) { Panel panel = (Panel)Component; if (panel.BorderStyle == BorderStyle.None) { DrawBorder(pe.Graphics); } base.OnPaintAdornments(pe); } ////// Creates a Dashed-Pen of appropriate color. /// protected Pen BorderPen { get { Color penColor = Control.BackColor.GetBrightness() < .5 ? ControlPaint.Light(Control.BackColor) : ControlPaint.Dark(Control.BackColor); Pen pen = new Pen(penColor); pen.DashStyle = DashStyle.Dash; return pen; } } } } // 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
- HiddenFieldPageStatePersister.cs
- CompressEmulationStream.cs
- CacheSection.cs
- QueryOptionExpression.cs
- ReadOnlyPermissionSet.cs
- GeneralTransform.cs
- IisTraceListener.cs
- InputBuffer.cs
- DeclarationUpdate.cs
- OleDbError.cs
- Events.cs
- RoleServiceManager.cs
- SoapHeaders.cs
- DockPanel.cs
- DeviceSpecificDesigner.cs
- SqlDataSourceCommandEventArgs.cs
- oledbmetadatacolumnnames.cs
- HtmlControlPersistable.cs
- OleDbPropertySetGuid.cs
- ItemContainerGenerator.cs
- TrustManagerMoreInformation.cs
- ConfigXmlWhitespace.cs
- DataGridPagerStyle.cs
- SectionRecord.cs
- BindingWorker.cs
- RawStylusInputCustomData.cs
- ResourcesChangeInfo.cs
- ManipulationCompletedEventArgs.cs
- SymbolEqualComparer.cs
- ReturnType.cs
- CultureInfoConverter.cs
- ChameleonKey.cs
- DataChangedEventManager.cs
- ViewLoader.cs
- AssemblyHash.cs
- Fonts.cs
- Logging.cs
- ParseChildrenAsPropertiesAttribute.cs
- XPathSelectionIterator.cs
- InitializingNewItemEventArgs.cs
- RbTree.cs
- ItemCheckedEvent.cs
- PersonalizationAdministration.cs
- QueryOptionExpression.cs
- DataGridDesigner.cs
- documentation.cs
- OleDbStruct.cs
- EmptyEnumerator.cs
- DataGridTextBox.cs
- mansign.cs
- SinglePageViewer.cs
- RightsManagementInformation.cs
- LineGeometry.cs
- StateDesigner.cs
- TransportationConfigurationTypeInstallComponent.cs
- ObjectTag.cs
- CompositeScriptReference.cs
- FixedElement.cs
- HtmlProps.cs
- Constraint.cs
- NativeWindow.cs
- ReadingWritingEntityEventArgs.cs
- FlowchartDesigner.xaml.cs
- ConfigurationElementCollection.cs
- TypedTableBase.cs
- KeyedCollection.cs
- DefaultTypeArgumentAttribute.cs
- LassoHelper.cs
- ExpressionBuilderCollection.cs
- CfgParser.cs
- SqlInternalConnectionSmi.cs
- DispatcherHooks.cs
- WebException.cs
- OracleDateTime.cs
- SqlRowUpdatingEvent.cs
- SQLGuid.cs
- LinqToSqlWrapper.cs
- LayoutManager.cs
- ManipulationLogic.cs
- XmlSchemaSet.cs
- HMACSHA384.cs
- DataQuery.cs
- ValueExpressions.cs
- TypeContext.cs
- OdbcDataAdapter.cs
- DataGridAddNewRow.cs
- DocumentPaginator.cs
- SrgsText.cs
- CategoryGridEntry.cs
- SignedXmlDebugLog.cs
- SyndicationDeserializer.cs
- Expander.cs
- Dump.cs
- dbdatarecord.cs
- FirstMatchCodeGroup.cs
- SystemBrushes.cs
- TypeSemantics.cs
- Repeater.cs
- SimpleTypeResolver.cs
- relpropertyhelper.cs