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
- TextSelectionHighlightLayer.cs
- WindowsFormsHelpers.cs
- RuleRefElement.cs
- HeaderedContentControl.cs
- Comparer.cs
- CommandID.cs
- CustomTypeDescriptor.cs
- MultiTrigger.cs
- TypeUsageBuilder.cs
- UiaCoreApi.cs
- ComplexPropertyEntry.cs
- ReadOnlyCollectionBase.cs
- MessageBox.cs
- BezierSegment.cs
- SqlComparer.cs
- ProxyManager.cs
- WebPartMenu.cs
- Utils.cs
- metadatamappinghashervisitor.cs
- HttpConfigurationContext.cs
- TlsnegoTokenProvider.cs
- CheckedPointers.cs
- AssemblyInfo.cs
- ProjectedSlot.cs
- HatchBrush.cs
- LogStore.cs
- CompiledQueryCacheEntry.cs
- InputProcessorProfilesLoader.cs
- HandleRef.cs
- DateTimeConstantAttribute.cs
- Asn1IntegerConverter.cs
- DeleteIndexBinder.cs
- RelationshipSet.cs
- Parallel.cs
- HandleCollector.cs
- WorkflowExecutor.cs
- PerformanceCounterCategory.cs
- XmlElementAttribute.cs
- SizeFConverter.cs
- InvalidWMPVersionException.cs
- EnumValidator.cs
- WorkflowViewService.cs
- PropertyMapper.cs
- WebPart.cs
- ColumnMapCopier.cs
- XmlSchemaGroup.cs
- ValueTable.cs
- ErrorStyle.cs
- ExecutionProperties.cs
- PrimaryKeyTypeConverter.cs
- ReflectPropertyDescriptor.cs
- PrivacyNoticeBindingElement.cs
- ParserExtension.cs
- Emitter.cs
- TypedMessageConverter.cs
- SslSecurityTokenParameters.cs
- Point.cs
- ControlParameter.cs
- _KerberosClient.cs
- BufferManager.cs
- DataObjectMethodAttribute.cs
- FastEncoderWindow.cs
- ToolStripDropDownMenu.cs
- SessionPageStatePersister.cs
- DataGridViewComboBoxColumnDesigner.cs
- ProcessHostMapPath.cs
- basemetadatamappingvisitor.cs
- NullExtension.cs
- DynamicPropertyHolder.cs
- AutoGeneratedFieldProperties.cs
- MarkedHighlightComponent.cs
- ReliableMessagingVersionConverter.cs
- XPathBinder.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DataGridViewLinkCell.cs
- ParentQuery.cs
- MimeXmlReflector.cs
- RoleManagerSection.cs
- COM2ExtendedUITypeEditor.cs
- WebPartZoneBase.cs
- SrgsDocumentParser.cs
- XmlSerializationReader.cs
- FixedMaxHeap.cs
- DurationConverter.cs
- CompModSwitches.cs
- ExceptionDetail.cs
- AnnotationMap.cs
- WorkflowWebService.cs
- MsmqMessage.cs
- WindowsTooltip.cs
- IndependentAnimationStorage.cs
- PrintDialog.cs
- Matrix3D.cs
- ReadOnlyCollection.cs
- DiagnosticsConfiguration.cs
- TextClipboardData.cs
- TypeEnumerableViewSchema.cs
- StateValidator.cs
- ConfigurationValidatorAttribute.cs
- DesigntimeLicenseContext.cs