Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / TrustUi / MS / Internal / documents / DialogBaseForm.cs / 1 / DialogBaseForm.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: // DialogBaseForm: Base class for all DRP dialogs. // // History: // 08/03/05 - [....] created // //--------------------------------------------------------------------------- using System; using System.Windows.Forms; using System.Drawing; using System.Globalization; using System.Windows.TrustUI; namespace MS.Internal.Documents { ////// DialogBaseForm is the base class for all DRP dialogs /// internal class DialogBaseForm : Form { #region Constructors //----------------------------------------------------- // // Constructors // //----------------------------------------------------- ////// The constructor /// public DialogBaseForm() { // Setup ToolTip object for dialogs _toolTip = new ToolTip(); _toolTip.Active = true; _toolTip.ShowAlways = true; InitializeComponent(); ApplyStyle(); ApplyResources(); ApplyRTL(); } #endregion Constructors #region Protected Methods //------------------------------------------------------ // // Protected Methods // //----------------------------------------------------- ////// InitializeComponent. /// protected virtual void InitializeComponent() { } ////// ApplyStyle. /// protected virtual void ApplyStyle() { ApplyDialogFont(this); // Setup the visual styles for our winform dialog. System.Windows.Forms.Application.EnableVisualStyles(); // Set the default background color BackColor = System.Drawing.SystemColors.Control; } ////// ApplyResources. /// protected virtual void ApplyResources() { Icon = Resources.DocumentApplication; } #endregion Protected Methods #region Private Methods //------------------------------------------------------ // // Private Methods // //------------------------------------------------------ ////// Method for applying font to all controls on the form. /// private void ApplyDialogFont(Control control) { //loop through all child controls and apply font foreach (Control c in control.Controls) { ApplyDialogFont(c); //Set the Font //Note: This doesn't handle menus or icons (currently DRP dialogs don't have these) c.Font = System.Drawing.SystemFonts.DialogFont; // Switch to GDI rendering for all controls that support it if (c is Label) { (c as Label).UseCompatibleTextRendering = false; } if (c is ButtonBase) { (c as ButtonBase).UseCompatibleTextRendering = false; } if (c is PropertyGrid) { (c as PropertyGrid).UseCompatibleTextRendering = false; } if (c is CheckedListBox) { (c as CheckedListBox).UseCompatibleTextRendering = false; } if (c is GroupBox) { (c as GroupBox).UseCompatibleTextRendering = false; } if (c is LinkLabel) { (c as LinkLabel).UseCompatibleTextRendering = false; } } } ////// Applies the WinForms RightToLeft and RightToLeftLayout properties based on the FlowDirection of /// DocumentApplicationDocumentViewer. /// private void ApplyRTL() { // Get the UI Language from the string table string uiLanguage = SR.Get(SRID.WPF_UILanguage); Invariant.Assert(!string.IsNullOrEmpty(uiLanguage), "No UILanguage was specified in stringtable."); // Set this dialog's RTL property based on the RTL property for the // language specified in the string table. CultureInfo uiCulture = new CultureInfo(uiLanguage); if ( uiCulture.TextInfo.IsRightToLeft ) { RightToLeft = RightToLeft.Yes; RightToLeftLayout = true; } else { RightToLeft = RightToLeft.No; RightToLeftLayout = false; } } #endregion Private Methods //----------------------------------------------------- // // Protected fields // //------------------------------------------------------ #region Protected Fields // The maximum number of characters allowed in the "Location," // "Name," and "Intent" fields for our Signing and RequestedSignature // dialogs. protected const int _maxLocationLength = 128; protected const int _maxNameLength = 128; protected const int _maxIntentLength = 256; // A reference to the general tooltip object used to assign tooltip // strings to controls. protected ToolTip _toolTip; #endregion Protected Fields } } // 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
- NumericUpDown.cs
- BrushMappingModeValidation.cs
- XmlBaseReader.cs
- SelectionRangeConverter.cs
- LayoutEvent.cs
- FormattedText.cs
- SettingsPropertyNotFoundException.cs
- OuterGlowBitmapEffect.cs
- InternalBufferOverflowException.cs
- CollectionChange.cs
- CheckBoxBaseAdapter.cs
- TransformerTypeCollection.cs
- WhitespaceRuleReader.cs
- SchemaCollectionPreprocessor.cs
- OleDbConnectionInternal.cs
- RIPEMD160Managed.cs
- GlyphTypeface.cs
- ScrollItemProviderWrapper.cs
- Propagator.JoinPropagator.cs
- ToolStripItemEventArgs.cs
- PropertyRef.cs
- DurableOperationAttribute.cs
- MergeFilterQuery.cs
- PropertyInformation.cs
- FloaterParaClient.cs
- CompiledIdentityConstraint.cs
- DbResourceAllocator.cs
- HttpListenerRequestTraceRecord.cs
- DetailsView.cs
- ReadWriteSpinLock.cs
- SchemaConstraints.cs
- XPathParser.cs
- SizeValueSerializer.cs
- HtmlHead.cs
- X500Name.cs
- FastPropertyAccessor.cs
- Dynamic.cs
- BindingCollection.cs
- XmlKeywords.cs
- PropertyTab.cs
- StorageConditionPropertyMapping.cs
- XamlToRtfParser.cs
- ExpressionBindings.cs
- AmbientValueAttribute.cs
- ContextMenuStripActionList.cs
- MimeFormatExtensions.cs
- DrawTreeNodeEventArgs.cs
- EntityCollectionChangedParams.cs
- ProviderConnectionPoint.cs
- SizeLimitedCache.cs
- TimeSpanFormat.cs
- DataKey.cs
- bidPrivateBase.cs
- PageParser.cs
- PersistChildrenAttribute.cs
- CompensationDesigner.cs
- AppSettingsReader.cs
- DbParameterCollectionHelper.cs
- ModuleBuilder.cs
- FilteredDataSetHelper.cs
- RegexNode.cs
- ColumnMapVisitor.cs
- BitmapInitialize.cs
- RepeatBehaviorConverter.cs
- ActivationServices.cs
- IdentitySection.cs
- EntityContainerRelationshipSetEnd.cs
- COM2ExtendedUITypeEditor.cs
- DataServiceRequestOfT.cs
- SyntaxCheck.cs
- HighlightOverlayGlyph.cs
- LongSumAggregationOperator.cs
- FormViewUpdateEventArgs.cs
- SerializerDescriptor.cs
- CategoryEditor.cs
- ParameterSubsegment.cs
- CodeTypeMemberCollection.cs
- ListenerSessionConnection.cs
- LZCodec.cs
- DataGridViewHitTestInfo.cs
- Misc.cs
- Configuration.cs
- DomainConstraint.cs
- SchemaObjectWriter.cs
- TraceLevelHelper.cs
- FormatterServices.cs
- ImageMapEventArgs.cs
- ErrorEventArgs.cs
- ReplyChannelAcceptor.cs
- ActionFrame.cs
- WebPartEditorOkVerb.cs
- Storyboard.cs
- SchemaImporterExtensionElement.cs
- _DomainName.cs
- MessageQueueEnumerator.cs
- RequestCachePolicyConverter.cs
- WsrmMessageInfo.cs
- NullReferenceException.cs
- HttpCacheVary.cs
- PieceDirectory.cs