Esempio n. 1
0
 /// <devdoc>
 /// This class represents all the information to render the winbar
 /// </devdoc>
 public ToolStripItemTextRenderEventArgs(Graphics g, ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign) : base(g, item)
 {
     Text             = text;
     TextRectangle    = textRectangle;
     DefaultTextColor = textColor;
     TextFont         = textFont;
     TextFormat       = ToolStripItemInternalLayout.ContentAlignToTextFormat(textAlign, item.RightToLeft == RightToLeft.Yes);
     TextFormat       = (item.ShowKeyboardCues) ? TextFormat : TextFormat | TextFormatFlags.HidePrefix;
     TextDirection    = item.TextDirection;
 }
        /// <include file='doc\ToolStripItemTextRenderEventArgs.uex' path='docs/doc[@for="ToolStripItemTextRenderEventArgs.ToolStripItemTextRenderEventArgs"]/*' />
        /// <devdoc>
        /// This class represents all the information to render the winbar
        /// </devdoc>
        public ToolStripItemTextRenderEventArgs(Graphics g, ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign) : base(g, item)
        {
            this.text             = text;
            this.textRectangle    = textRectangle;
            this.defaultTextColor = textColor;
            this.textFont         = textFont;
            this.textFormat       = ToolStripItemInternalLayout.ContentAlignToTextFormat(textAlign, item.RightToLeft == RightToLeft.Yes);

            // in 2K and XP++ hide underlined &File unless ALT is pressed
            this.textFormat = (item.ShowKeyboardCues) ? textFormat : textFormat | TextFormatFlags.HidePrefix;
            textDirection   = item.TextDirection;
        }
 public ToolStripItemTextRenderEventArgs(Graphics g, ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign) : base(g, item)
 {
     this.textRectangle    = Rectangle.Empty;
     this.textColor        = SystemColors.ControlText;
     this.textDirection    = ToolStripTextDirection.Horizontal;
     this.defaultTextColor = SystemColors.ControlText;
     this.text             = text;
     this.textRectangle    = textRectangle;
     this.defaultTextColor = textColor;
     this.textFont         = textFont;
     this.textFormat       = ToolStripItemInternalLayout.ContentAlignToTextFormat(textAlign, item.RightToLeft == RightToLeft.Yes);
     this.textFormat       = item.ShowKeyboardCues ? this.textFormat : (this.textFormat | TextFormatFlags.HidePrefix);
     this.textDirection    = item.TextDirection;
 }
 internal void InvalidateItemLayout(string affectedProperty, bool invalidatePainting)
 {
     this.toolStripItemInternalLayout = null;
     if (this.Owner != null)
     {
         LayoutTransaction.DoLayout(this.Owner, this, affectedProperty);
     }
     if (invalidatePainting && (this.Owner != null))
     {
         this.Owner.Invalidate();
     }
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.state[stateDisposing] = true;
         if (this.Owner != null)
         {
             this.StopAnimate();
             this.Owner.Items.Remove(this);
             this.toolStripItemInternalLayout = null;
             this.state[stateDisposed] = true;
         }
     }
     base.Dispose(disposing);
     if (disposing)
     {
         this.Properties.SetObject(PropMirroredImage, null);
         this.Properties.SetObject(PropImage, null);
         this.state[stateDisposing] = false;
     }
 }
 protected virtual void OnFontChanged(EventArgs e)
 {
     this.cachedTextSize = System.Drawing.Size.Empty;
     if ((this.DisplayStyle & ToolStripItemDisplayStyle.Text) == ToolStripItemDisplayStyle.Text)
     {
         this.InvalidateItemLayout(PropertyNames.Font);
     }
     else
     {
         this.toolStripItemInternalLayout = null;
     }
     this.RaiseEvent(EventFontChanged, e);
 }