Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / SplitterDesigner.cs / 1 / SplitterDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.SplitterDesigner..ctor()")] namespace System.Windows.Forms.Design { using System.Design; using System.ComponentModel; using System.Diagnostics; using System.Drawing.Drawing2D; using System; using System.Drawing; using System.Windows.Forms; using Microsoft.Win32; ////// /// This class handles all design time behavior for the splitter class. This /// draws a visible border on the splitter if it doesn't have a border so the /// user knows where the boundaries of the splitter lie. /// internal class SplitterDesigner : ControlDesigner { public SplitterDesigner() { 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. /// ///private void DrawBorder(Graphics graphics) { Control ctl = Control; Rectangle rc = ctl.ClientRectangle; Color penColor; // Black or white pen? Depends on the color of the control. // if (ctl.BackColor.GetBrightness() < .5) { penColor = Color.White; } else { penColor = Color.Black; } using (Pen pen = new Pen(penColor)) { pen.DashStyle = DashStyle.Dash; rc.Width --; rc.Height--; graphics.DrawRectangle(pen, rc); } } /// /// /// 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) { Splitter splitter = (Splitter)Component; base.OnPaintAdornments(pe); if (splitter.BorderStyle == BorderStyle.None) { DrawBorder(pe.Graphics); } } protected override void WndProc(ref Message m) { switch (m.Msg) { case NativeMethods.WM_WINDOWPOSCHANGED: // Really only care about window size changing Control source = (Control)Control; source.Invalidate(); break; } base.WndProc(ref m); } } } // 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
- MatrixAnimationUsingPath.cs
- XmlDataSourceView.cs
- ExpressionEditorAttribute.cs
- ItemChangedEventArgs.cs
- CacheMemory.cs
- RowTypePropertyElement.cs
- TextRangeSerialization.cs
- AnnotationResource.cs
- StrokeRenderer.cs
- GenerateTemporaryTargetAssembly.cs
- FontResourceCache.cs
- UTF8Encoding.cs
- BitmapMetadataBlob.cs
- GeneralTransform2DTo3DTo2D.cs
- SqlClientWrapperSmiStreamChars.cs
- BinaryMessageEncodingBindingElement.cs
- DataPager.cs
- StrokeCollectionConverter.cs
- WebPartMovingEventArgs.cs
- TemplateModeChangedEventArgs.cs
- SqlDataSourceCache.cs
- XmlSubtreeReader.cs
- MainMenu.cs
- FileLoadException.cs
- Pkcs7Recipient.cs
- KerberosRequestorSecurityToken.cs
- Pkcs9Attribute.cs
- GPStream.cs
- QuaternionRotation3D.cs
- EditorAttribute.cs
- Dump.cs
- WebSysDescriptionAttribute.cs
- DesignerContextDescriptor.cs
- RangeValidator.cs
- LinqDataSource.cs
- _TimerThread.cs
- Vector3DCollectionValueSerializer.cs
- ADMembershipProvider.cs
- Properties.cs
- UnmanagedHandle.cs
- XsltCompileContext.cs
- MetadataArtifactLoaderResource.cs
- ImportRequest.cs
- ProfileManager.cs
- TableDetailsCollection.cs
- TextDecorationCollection.cs
- _SingleItemRequestCache.cs
- MimeFormImporter.cs
- ToolBarOverflowPanel.cs
- ToolStripSeparatorRenderEventArgs.cs
- CallbackHandler.cs
- StrongNameUtility.cs
- AvTraceFormat.cs
- CharConverter.cs
- ResXResourceReader.cs
- XpsPackagingException.cs
- PassportAuthentication.cs
- PenContexts.cs
- Point3DAnimationBase.cs
- FixedSOMPage.cs
- WebContext.cs
- SoapAttributeOverrides.cs
- DataGridViewTopLeftHeaderCell.cs
- SymmetricAlgorithm.cs
- CustomPopupPlacement.cs
- ScrollableControl.cs
- Dispatcher.cs
- EntityKey.cs
- SortDescriptionCollection.cs
- ForEachAction.cs
- BevelBitmapEffect.cs
- Console.cs
- ModelPerspective.cs
- DocumentViewerBaseAutomationPeer.cs
- ResourceDefaultValueAttribute.cs
- Assert.cs
- DateBoldEvent.cs
- HealthMonitoringSectionHelper.cs
- WebSysDefaultValueAttribute.cs
- StringUtil.cs
- OrCondition.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- WaitHandle.cs
- ActivitySurrogateSelector.cs
- Translator.cs
- XmlChildEnumerator.cs
- HtmlTableCell.cs
- _IPv4Address.cs
- DeleteHelper.cs
- ProcessHost.cs
- CurrentChangingEventArgs.cs
- ConfigurationStrings.cs
- FileDialogCustomPlace.cs
- PocoEntityKeyStrategy.cs
- ZipPackage.cs
- DateTimeUtil.cs
- PageClientProxyGenerator.cs
- CryptoConfig.cs
- BamlReader.cs
- ProtocolsConfigurationHandler.cs