Code:
/ FX-1434 / FX-1434 / 1.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
- FileController.cs
- QuaternionConverter.cs
- CmsUtils.cs
- CssStyleCollection.cs
- ApplicationProxyInternal.cs
- IdentityManager.cs
- Item.cs
- OrderPreservingSpoolingTask.cs
- ProvidersHelper.cs
- ProxyManager.cs
- SystemIPInterfaceStatistics.cs
- assertwrapper.cs
- CustomExpressionEventArgs.cs
- EllipseGeometry.cs
- TextEditorCopyPaste.cs
- TabletDeviceInfo.cs
- NameValueSectionHandler.cs
- DataListItem.cs
- JpegBitmapDecoder.cs
- BuildTopDownAttribute.cs
- NativeMethods.cs
- TraceLog.cs
- GenericsInstances.cs
- MissingSatelliteAssemblyException.cs
- BamlResourceContent.cs
- FileLogRecordHeader.cs
- XamlReaderHelper.cs
- DataFieldEditor.cs
- EnvelopedPkcs7.cs
- SHA512Managed.cs
- SmtpCommands.cs
- ProfileInfo.cs
- TripleDESCryptoServiceProvider.cs
- ProfileModule.cs
- TextLine.cs
- SmiEventSink.cs
- IntegerValidator.cs
- PageHandlerFactory.cs
- ServerValidateEventArgs.cs
- RectangleF.cs
- SymDocumentType.cs
- AspCompat.cs
- RowSpanVector.cs
- WindowAutomationPeer.cs
- Point3DAnimation.cs
- ColorAnimationBase.cs
- ListControl.cs
- DecoderExceptionFallback.cs
- CorrelationHandle.cs
- recordstatescratchpad.cs
- xdrvalidator.cs
- ObfuscateAssemblyAttribute.cs
- PresentationTraceSources.cs
- XPathCompileException.cs
- CodeCatchClauseCollection.cs
- Group.cs
- SetMemberBinder.cs
- TableColumnCollectionInternal.cs
- TextServicesLoader.cs
- PointCollectionValueSerializer.cs
- StatusStrip.cs
- Automation.cs
- XamlPointCollectionSerializer.cs
- SaveWorkflowCommand.cs
- SessionIDManager.cs
- SqlMultiplexer.cs
- MgmtResManager.cs
- TrailingSpaceComparer.cs
- TreeNodeClickEventArgs.cs
- DomainUpDown.cs
- ScriptManager.cs
- TreeNodeMouseHoverEvent.cs
- PersonalizationState.cs
- StyleSheetComponentEditor.cs
- SettingsProperty.cs
- SamlAction.cs
- SqlIdentifier.cs
- Propagator.ExtentPlaceholderCreator.cs
- WebPartDisplayModeEventArgs.cs
- CultureInfoConverter.cs
- ArgumentException.cs
- TableLayoutSettings.cs
- PrinterSettings.cs
- MissingMemberException.cs
- SoapTypeAttribute.cs
- FilterableAttribute.cs
- ForceCopyBuildProvider.cs
- WorkerRequest.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- TrustLevel.cs
- MetadataHelper.cs
- ComboBoxHelper.cs
- ToolTip.cs
- EntryPointNotFoundException.cs
- CompressionTransform.cs
- ValidationError.cs
- SelectionRangeConverter.cs
- TraversalRequest.cs
- BuilderElements.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs