当前位置: 首页>>代码示例>>C#>>正文


C# RightToLeft类代码示例

本文整理汇总了C#中RightToLeft的典型用法代码示例。如果您正苦于以下问题:C# RightToLeft类的具体用法?C# RightToLeft怎么用?C# RightToLeft使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RightToLeft类属于命名空间,在下文中一共展示了RightToLeft类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawBackgroundImage

 public static void DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset, RightToLeft rightToLeft)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     if (backgroundImageLayout == ImageLayout.Tile)
     {
         using (TextureBrush brush = new TextureBrush(backgroundImage, WrapMode.Tile))
         {
             if (scrollOffset != Point.Empty)
             {
                 Matrix transform = brush.Transform;
                 transform.Translate((float) scrollOffset.X, (float) scrollOffset.Y);
                 brush.Transform = transform;
             }
             g.FillRectangle(brush, clipRect);
             return;
         }
     }
     Rectangle rect = CalculateBackgroundImageRectangle(bounds, backgroundImage, backgroundImageLayout);
     if ((rightToLeft == RightToLeft.Yes) && (backgroundImageLayout == ImageLayout.None))
     {
         rect.X += clipRect.Width - rect.Width;
     }
     using (SolidBrush brush2 = new SolidBrush(backColor))
     {
         g.FillRectangle(brush2, clipRect);
     }
     if (!clipRect.Contains(rect))
     {
         if ((backgroundImageLayout == ImageLayout.Stretch) || (backgroundImageLayout == ImageLayout.Zoom))
         {
             rect.Intersect(clipRect);
             g.DrawImage(backgroundImage, rect);
         }
         else if (backgroundImageLayout == ImageLayout.None)
         {
             rect.Offset(clipRect.Location);
             Rectangle destRect = rect;
             destRect.Intersect(clipRect);
             Rectangle rectangle3 = new Rectangle(Point.Empty, destRect.Size);
             g.DrawImage(backgroundImage, destRect, rectangle3.X, rectangle3.Y, rectangle3.Width, rectangle3.Height, GraphicsUnit.Pixel);
         }
         else
         {
             Rectangle rectangle4 = rect;
             rectangle4.Intersect(clipRect);
             Rectangle rectangle5 = new Rectangle(new Point(rectangle4.X - rect.X, rectangle4.Y - rect.Y), rectangle4.Size);
             g.DrawImage(backgroundImage, rectangle4, rectangle5.X, rectangle5.Y, rectangle5.Width, rectangle5.Height, GraphicsUnit.Pixel);
         }
     }
     else
     {
         ImageAttributes imageAttr = new ImageAttributes();
         imageAttr.SetWrapMode(WrapMode.TileFlipXY);
         g.DrawImage(backgroundImage, rect, 0, 0, backgroundImage.Width, backgroundImage.Height, GraphicsUnit.Pixel, imageAttr);
         imageAttr.Dispose();
     }
 }
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:60,代码来源:CmbControlPaintEx.cs

示例2: CommonLayout

 internal static LayoutOptions CommonLayout(Rectangle clientRectangle, Padding padding, bool isDefault, Font font, string text, bool enabled, ContentAlignment textAlign, RightToLeft rtl)
 {
     return new LayoutOptions { 
         client = LayoutUtils.DeflateRect(clientRectangle, padding), padding = padding, growBorderBy1PxWhenDefault = true, isDefault = isDefault, borderSize = 2, paddingSize = 0, maxFocus = true, focusOddEvenFixup = false, font = font, text = text, imageSize = Size.Empty, checkSize = 0, checkPaddingSize = 0, checkAlign = ContentAlignment.TopLeft, imageAlign = ContentAlignment.MiddleCenter, textAlign = textAlign, 
         hintTextUp = false, shadowedText = !enabled, layoutRTL = RightToLeft.Yes == rtl, textImageRelation = TextImageRelation.Overlay, useCompatibleTextRendering = false
      };
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ButtonBaseAdapter.cs

示例3: TextEditBase

        /// <summary>
        /// Creates a new instance of TextEditBase class.
        /// </summary>
        public TextEditBase()
        {
            TextBox = new TextBox();
            Width = 120;
            Height = 20;

            rtl = RightToLeft.Yes;
            base.BackColor = SystemColors.Window;
            TextBox.RightToLeft = rtl;
            TextBox.BorderStyle = BorderStyle.None;
            TextBox.AutoSize = false;

            TextBox.MouseEnter += TextBox_MouseEnter;
            TextBox.MouseLeave += TextBox_MouseLeave;
            TextBox.GotFocus += TextBox_GotFocus;
            TextBox.LostFocus += TextBox_LostFocus;
            TextBox.SizeChanged += TextBox_SizeChanged;
            TextBox.TextChanged += TextBox_TextChanged;
            TextBox.MouseUp += InvokeMouseUp;
            TextBox.MouseDown += InvokeMouseDown;
            TextBox.MouseEnter += InvokeMouseEnter;
            TextBox.MouseHover += InvokeMouseHover;
            TextBox.MouseLeave += InvokeMouseLeave;
            TextBox.MouseMove += InvokeMouseMove;
            TextBox.KeyDown += InvokeKeyDown;
            TextBox.KeyPress += InvokeKeyPress;
            TextBox.KeyUp += InvokeKeyUp;
            TextBox.Click += InvokeClick;
            TextBox.DoubleClick += InvokeDoubleClick;

            ThemeChanged += OnThemeChanged;
            Controls.Add(TextBox);
        }
开发者ID:HEskandari,项目名称:FarsiLibrary,代码行数:36,代码来源:TextEditBase.cs

示例4: DropDownButtonBounds

		/*
		 * DropDownButtonBounds
		 */

		/// <summary>
		/// </summary>
		/// <param name="clientRectangle"></param>
		/// <param name="rightToLeft"></param>
		/// <returns></returns>
		public static Rectangle DropDownButtonBounds(Rectangle clientRectangle, RightToLeft rightToLeft)
		{
			Rectangle buttonBounds = Rectangle.Empty;

			if (rightToLeft == RightToLeft.No)
			{
				buttonBounds = new Rectangle(
					clientRectangle.Right - SystemInformation.VerticalScrollBarWidth,
					clientRectangle.Top,
					SystemInformation.VerticalScrollBarWidth,
					clientRectangle.Height
				);
			}
			else
			{
				buttonBounds = new Rectangle(
					clientRectangle.Left,
					clientRectangle.Top,
					SystemInformation.VerticalScrollBarWidth,
					clientRectangle.Height
				);
			}

			return buttonBounds;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:34,代码来源:NuGenControlPaint.Control.cs

示例5: GetContentRectangle

		/// <summary>
		/// </summary>
		public Rectangle GetContentRectangle(
			Rectangle clientRectangle
			, Rectangle arrowRectangle
			, RightToLeft rightToLeft
			)
		{
			Rectangle contentRectangle;

			if (rightToLeft == RightToLeft.Yes)
			{
				contentRectangle = Rectangle.FromLTRB(
					arrowRectangle.Right
					, clientRectangle.Top
					, clientRectangle.Right
					, clientRectangle.Bottom
				);
			}
			else
			{
				contentRectangle = Rectangle.FromLTRB(
					clientRectangle.Left
					, clientRectangle.Top
					, arrowRectangle.Left
					, clientRectangle.Bottom
				);
			}

			return Rectangle.Inflate(contentRectangle, -6, -6);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:31,代码来源:NuGenSmoothSplitButtonLayoutManager.cs

示例6: ViewLayoutViewport

        /// <summary>
        /// Initialize a new instance of the ViewLayoutViewport class.
        /// </summary>
        /// <param name="paletteMetrics">Palette source for metrics.</param>
        /// <param name="metricPadding">Metric used to get view padding.</param>
        /// <param name="metricOvers">Metric used to get overposition.</param>
        /// <param name="orientation">Orientation for the viewport children.</param>
        /// <param name="alignment">Alignment of the children within the viewport.</param>
        /// <param name="animateChange">Animate changes in the viewport.</param>
        public ViewLayoutViewport(IPaletteMetric paletteMetrics,
                                  PaletteMetricPadding metricPadding,
                                  PaletteMetricInt metricOvers,
                                  VisualOrientation orientation,
                                  RelativePositionAlign alignment,
                                  bool animateChange)
        {
            // Remember the source information
            _paletteMetrics = paletteMetrics;
            _metricPadding = metricPadding;
            _metricOvers = metricOvers;
            _orientation = orientation;
            _alignment = alignment;
            _animateChange = animateChange;

            // Default other state
            _offset = Point.Empty;
            _extent = Size.Empty;
            _rightToLeft = RightToLeft.No;
            _rightToLeftLayout = false;
            _fillSpace = false;
            _counterAlignment = RelativePositionAlign.Far;

            // Create a timer for animation effect
            _animationTimer = new Timer();
            _animationTimer.Interval = _animationInterval;
            _animationTimer.Tick += new EventHandler(OnAnimationTick);
        }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:37,代码来源:ViewLayoutViewport.cs

示例7: GetArrowRectangle

		/// <summary>
		/// </summary>
		public Rectangle GetArrowRectangle(Rectangle clientRectangle, RightToLeft rightToLeft)
		{
			Point arrowLocation = new Point(clientRectangle.Left, clientRectangle.Top);
			Size arrowSize = new Size(28, clientRectangle.Height);

			if (rightToLeft == RightToLeft.No)
			{
				arrowLocation.X = clientRectangle.Right - arrowSize.Width;
			}

			return Rectangle.Inflate(new Rectangle(arrowLocation, arrowSize), -3, -6);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:NuGenSmoothSplitButtonLayoutManager.cs

示例8: PaintPopupLayout

 internal static ButtonBaseAdapter.LayoutOptions PaintPopupLayout(Graphics g, bool show3D, int checkSize, Rectangle clientRectangle, Padding padding, bool isDefault, Font font, string text, bool enabled, ContentAlignment textAlign, RightToLeft rtl)
 {
     ButtonBaseAdapter.LayoutOptions options = ButtonBaseAdapter.CommonLayout(clientRectangle, padding, isDefault, font, text, enabled, textAlign, rtl);
     options.shadowedText = false;
     if (show3D)
     {
         options.checkSize = (int) ((checkSize * CheckableControlBaseAdapter.GetDpiScaleRatio(g)) + 1f);
         return options;
     }
     options.checkSize = (int) (checkSize * CheckableControlBaseAdapter.GetDpiScaleRatio(g));
     options.checkPaddingSize = 1;
     return options;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:CheckBoxPopupAdapter.cs

示例9: Language

        /// <summary>
        /// Set default values of Language
        /// </summary>
        public Language()
        {
            _langCode = "en";
            _langName = "English";
            _author = "Dương Diệu Pháp";
            _description = "English";
            _minVersion = "3.5.0.0";
            _fileName = "";
            _isRightToLeftLayout = RightToLeft.No;

            _Items = new LanguageItem<string, string>();
            InitDefaultLanguageDictionary();
        }
开发者ID:d2phap,项目名称:ImageGlass,代码行数:16,代码来源:Language.cs

示例10: GetGridPanelBounds

		/// <summary>
		/// </summary>
		public Rectangle GetGridPanelBounds(Rectangle clientRectangle, RightToLeft rightToLeft)
		{
			if (rightToLeft == RightToLeft.Yes)
			{
				return new Rectangle(
					clientRectangle.Left
					, clientRectangle.Top + 1
					, clientRectangle.Width - 1
					, clientRectangle.Height - 1
				);
			}

			return new Rectangle(
				clientRectangle.Left + 1
				, clientRectangle.Top + 1
				, clientRectangle.Width - 1
				, clientRectangle.Height - 1
			);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:21,代码来源:NuGenSmoothThumbnailLayoutManager.cs

示例11: RTLContentAlignment

		/*
		 * RTLContentAlignment
		 */

		/// <summary>
		/// Converts the specified <see cref="ContentAlignment"/> to its right-to-left representation.
		/// </summary>
		/// <returns>
		/// The specified <see cref="ContentAlignment"/> is converted only if right-to-left layout is specified;
		/// otherwise, it is left as is.
		/// </returns>
		public static ContentAlignment RTLContentAlignment(ContentAlignment contentAlignment, RightToLeft rightToLeft)
		{
			if (rightToLeft == RightToLeft.Yes)
			{
				switch (contentAlignment)
				{
					case ContentAlignment.BottomLeft: return ContentAlignment.BottomRight;
					case ContentAlignment.BottomRight: return ContentAlignment.BottomLeft;
					case ContentAlignment.MiddleLeft: return ContentAlignment.MiddleRight;
					case ContentAlignment.MiddleRight: return ContentAlignment.MiddleLeft;
					case ContentAlignment.TopLeft: return ContentAlignment.TopRight;
					case ContentAlignment.TopRight: return ContentAlignment.TopLeft;
					default: return contentAlignment;
				}
			}

			return contentAlignment;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:NuGenControlPaint.Control.cs

示例12: RightToLeftIndex

 private static int RightToLeftIndex(RightToLeft rtl, PaletteRelativeAlign align)
 {
     switch (align)
     {
         case PaletteRelativeAlign.Near:
             return (rtl == RightToLeft.Yes ? 2 : 0);
         case PaletteRelativeAlign.Center:
             return 1;
         case PaletteRelativeAlign.Far:
             return (rtl == RightToLeft.Yes ? 0 : 2);
         default:
             // Should never happen!
             Debug.Assert(false);
             throw new ArgumentOutOfRangeException("align");
     }
 }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:16,代码来源:RenderStandard.cs

示例13: DrawImagesAndText

        /// <summary>
        /// Draws the text and image objects at the specified location. 
        /// </summary>
        /// <param name="graphics">The Graphics to draw on.</param>
        /// <param name="captionRectangle">The drawing rectangle on a panel's caption.</param>
        /// <param name="iSpacing">The spacing on a panel's caption</param>
        /// <param name="imageRectangle">The rectangle of an image displayed on a panel's caption.</param>
        /// <param name="image">The image that is displayed on a panel's caption.</param>
        /// <param name="rightToLeft">A value indicating whether control's elements are aligned to support locales using right-to-left fonts.</param>
        /// <param name="bDrawBackground">A value indicating whether the background of the images is displayed</param>
        /// <param name="bIsClosable">A value indicating whether the xpanderpanel is closable</param>
        /// <param name="bShowCloseIcon">A value indicating whether the close image is displayed</param>
        /// <param name="imageClosePanel">The close image that is displayed on a panel's caption.</param>
        /// <param name="foreColorCloseIcon">The foreground color of the close image that is displayed on a panel's caption.</param>
        /// <param name="rectangleImageClosePanel">The rectangle of the close image that is displayed on a panel's caption.</param>
        /// <param name="bShowExpandIcon">A value indicating whether the expand image is displayed</param>
        /// <param name="imageExandPanel">The expand image that is displayed on a panel's caption.</param>
        /// <param name="foreColorExpandIcon">The foreground color of the expand image displayed by this caption.</param>
        /// <param name="rectangleImageExandPanel">the rectangle of the expand image displayed by this caption.</param>
        /// <param name="fontCaption">The font of the text displayed on a panel's caption.</param>
        /// <param name="captionForeColor">The foreground color of the text displayed on a panel's caption.</param>
        /// <param name="strCaptionText">The text which is associated with this caption.</param>
        protected static void DrawImagesAndText(
            Graphics graphics,
            Rectangle captionRectangle,
            int iSpacing,
            Rectangle imageRectangle,
            Image image,
            RightToLeft rightToLeft,
            bool bDrawBackground,
            bool bIsClosable,
            bool bShowCloseIcon,
            Image imageClosePanel,
            Color foreColorCloseIcon,
            ref Rectangle rectangleImageClosePanel,
            bool bShowExpandIcon,
            Image imageExandPanel,
            Color foreColorExpandIcon,
            ref Rectangle rectangleImageExandPanel,
            Font fontCaption,
            Color captionForeColor,
            string strCaptionText)
        {
            //DrawImages
            int iTextPositionX1 = iSpacing;
            int iTextPositionX2 = captionRectangle.Right - iSpacing;

            imageRectangle.Y = (captionRectangle.Height - imageRectangle.Height) / 2;

            if (rightToLeft == RightToLeft.No)
            {
                if (image != null)
                {
                    DrawImage(graphics, image, imageRectangle);
                    iTextPositionX1 += imageRectangle.Width + iSpacing;
                    iTextPositionX2 -= iTextPositionX1;
                }
            }
            else
            {
                if ((bShowCloseIcon == true) && (imageClosePanel != null))
                {
                    rectangleImageClosePanel = imageRectangle;
                    rectangleImageClosePanel.X = imageRectangle.X;
                    if (bIsClosable == true)
                    {
                        DrawChevron(graphics, imageClosePanel, rectangleImageClosePanel, foreColorCloseIcon, bDrawBackground, imageRectangle.Y);
                    }
                    iTextPositionX1 = rectangleImageClosePanel.X + rectangleImageClosePanel.Width;
                }
                if ((bShowExpandIcon == true) && (imageExandPanel != null))
                {
                    rectangleImageExandPanel = imageRectangle;
                    rectangleImageExandPanel.X = imageRectangle.X;
                    if ((bShowCloseIcon == true) && (imageClosePanel != null))
                    {
                        rectangleImageExandPanel.X = iTextPositionX1 + (iSpacing / 2);
                    }
                    DrawChevron(graphics, imageExandPanel, rectangleImageExandPanel, foreColorExpandIcon, bDrawBackground, imageRectangle.Y);
                    iTextPositionX1 = rectangleImageExandPanel.X + rectangleImageExandPanel.Width;
                }
            }
            //
            // Draw Caption text
            //
            Rectangle textRectangle = captionRectangle;
            textRectangle.X = iTextPositionX1;
            textRectangle.Width -= iTextPositionX1 + iSpacing;
            if (rightToLeft == RightToLeft.No)
            {
                if ((bShowCloseIcon == true) && (imageClosePanel != null))
                {
                    rectangleImageClosePanel = imageRectangle;
                    rectangleImageClosePanel.X = captionRectangle.Right - iSpacing - imageRectangle.Width;
                    if (bIsClosable == true)
                    {
                        DrawChevron(graphics, imageClosePanel, rectangleImageClosePanel, foreColorCloseIcon, bDrawBackground, imageRectangle.Y);
                    }
                    iTextPositionX2 = rectangleImageClosePanel.X;
                }
//.........这里部分代码省略.........
开发者ID:wuyanqing,项目名称:wc001,代码行数:101,代码来源:BasePanel.cs

示例14: RTLTranslateDropDownDirection

     private ToolStripDropDownDirection RTLTranslateDropDownDirection(ToolStripDropDownDirection dropDownDirection, RightToLeft rightToLeft) {
         switch (dropDownDirection) {
             case ToolStripDropDownDirection.AboveLeft:
                  return ToolStripDropDownDirection.AboveRight;
              case ToolStripDropDownDirection.AboveRight:
                  return ToolStripDropDownDirection.AboveLeft;
              case ToolStripDropDownDirection.BelowRight:
                  return ToolStripDropDownDirection.BelowLeft;
              case ToolStripDropDownDirection.BelowLeft:
                  return ToolStripDropDownDirection.BelowRight;
              case ToolStripDropDownDirection.Right:
                  return ToolStripDropDownDirection.Left;
              case ToolStripDropDownDirection.Left:
                  return ToolStripDropDownDirection.Right;
           }
           Debug.Fail("Why are we here");
           
           // dont expect it to come to this but just in case here are the real defaults.
           if (IsOnDropDown) {
                return (rightToLeft == RightToLeft.Yes) ? ToolStripDropDownDirection.Left : ToolStripDropDownDirection.Right;
           }
           else {
               return (rightToLeft == RightToLeft.Yes) ? ToolStripDropDownDirection.BelowLeft : ToolStripDropDownDirection.BelowRight;
           }
 
 
     }
开发者ID:JianwenSun,项目名称:cc,代码行数:27,代码来源:ToolStripDropDownItem.cs

示例15: FlatComboAdapter

      /// <summary>
      ///  Constructeur
      /// </summary>
      /// <param name="comboBox">référence sur la combo à peindre</param>
      /// <param name="smallButton">si true, dessiner un petit bouton pour le drop-down</param>
      public FlatComboAdapter( ComboBox comboBox, bool smallButton ) {
        this.comboBox = comboBox;

        clientRect = comboBox.ClientRectangle;
        origRightToLeft = comboBox.RightToLeft;

        int dropDownButtonWidth = System.Windows.Forms.SystemInformation.HorizontalScrollBarArrowWidth;
        outerBorder = new Rectangle( clientRect.Location, new Size( clientRect.Width - 1, clientRect.Height - 1 ) );
        innerBorder = new Rectangle( outerBorder.X + 1, outerBorder.Y + 1, outerBorder.Width - dropDownButtonWidth - 2, outerBorder.Height - 2 );
        innerInnerBorder = new Rectangle( innerBorder.X + 1, innerBorder.Y + 1, innerBorder.Width - 2, innerBorder.Height - 2 );
        dropDownRect = new Rectangle( innerBorder.Right + 1, innerBorder.Y, dropDownButtonWidth, innerBorder.Height + 1 );

        // fill in several pixels of the dropdown rect with white so that it looks like the combo button is thinner.
        if ( smallButton ) {
          whiteFillRect = dropDownRect;
          whiteFillRect.Width = WhiteFillRectWidth;
          dropDownRect.X += WhiteFillRectWidth;
          dropDownRect.Width -= WhiteFillRectWidth;
        }

        if ( origRightToLeft == RightToLeft.Yes ) {
          innerBorder.X = clientRect.Width - innerBorder.Right;
          innerInnerBorder.X = clientRect.Width - innerInnerBorder.Right;
          dropDownRect.X = clientRect.Width - dropDownRect.Right;
          whiteFillRect.X = clientRect.Width - whiteFillRect.Right + 1;  // since we're filling, we need to move over to the next px.
        }
      }
开发者ID:NicolasR,项目名称:Composants,代码行数:32,代码来源:ToolStripComboBoxHost.cs


注:本文中的RightToLeft类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。