public Preferences() : base() { InitializeComponent(); Text = String.Concat(Locale.Current.Preferences.WindowTitle, " - ", Program.MainForm.Text); Icon = Program.MainForm.Icon; TopMost = true; _iconApps = Utilities.ResourceHelper.GetImage("gmail-limon.png"); _iconStandard = Utilities.ResourceHelper.GetImage("gmail-bleu.png"); _rendererListLarge = Shellscape.UI.VisualStyles.ControlPanel.GetRenderer(Shellscape.UI.VisualStyles.ControlPanel.ControlPanelPart.MessageText, 0, true); _rendererListSmall = Shellscape.UI.VisualStyles.ControlPanel.GetRenderer(Shellscape.UI.VisualStyles.ControlPanel.ControlPanelPart.BodyText, 0, true); _titleElement = Shellscape.UI.VisualStyles.ControlPanel.GetElement( Shellscape.UI.VisualStyles.ControlPanel.ControlPanelPart.Title, 0, true ); InitNavigation(); InitGeneralPanel(); InitAccountsPanel(); InitAccountPanel(); if (Config.Current.FirstRun) { InitFirstRun(); } HidePanels(); _PanelGeneral.Visible = true; }
/// <summary> /// Class constructor accepting a starting time value /// </summary> /// <param name="time">Array of integers specifying /// <code>{days,hours,minutes,seconds}</code> /// </param> public Remit(int[] time) { /* set the timer values, so that it can continue if it just * switched over from normal mode */ days = time[0]; hours = time[1]; minutes = time[2]; seconds = time[3]; bool vs = true; // visual styles work InitializeComponent(); /* Just encase something odd happens and visual styles aren't available, don't * break the program entirely :) */ try { vse = VisualStyleElement.Taskbar.BackgroundTop.Normal; vsr = new VisualStyleRenderer(vse); } catch (Exception ex) { vs = false; // ok, no they don't :( MessageBox.Show( String.Format("Unable to aquire Visual Style renderer:\n {0}", ex.Message), "Problem", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // don't bother forcing user painting if we couldn't get the vsr if (vs) { this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); } }
protected override void PaintElementSkin(Telerik.WinControls.Paint.IGraphics graphics) { base.PaintElementSkin(graphics); if ((this.Parent as RadScrollBarElement).ScrollType == ScrollType.Horizontal) { VisualStyles.VisualStyleElement gripperGlyph = VisualStyles.VisualStyleElement.ScrollBar.GripperHorizontal.Normal; if (SystemSkinManager.Instance.SetCurrentElement(gripperGlyph)) { Graphics g = (Graphics)graphics.UnderlayGraphics; Size sz = SystemSkinManager.Instance.GetPartPreferredSize(g, this.Bounds, System.Windows.Forms.VisualStyles.ThemeSizeType.True); Point gripperLocation = new Point((int)(this.ControlBoundingRectangle.Width - sz.Width) / 2, (int)(this.ControlBoundingRectangle.Height - sz.Height) / 2); Rectangle arrowRect = new Rectangle(gripperLocation, sz); SystemSkinManager.Instance.PaintCurrentElement(g, arrowRect); } } else { VisualStyles.VisualStyleElement gripperGlyph = VisualStyles.VisualStyleElement.ScrollBar.GripperVertical.Normal; if (SystemSkinManager.Instance.SetCurrentElement(gripperGlyph)) { Graphics g = (Graphics)graphics.UnderlayGraphics; Size sz = SystemSkinManager.Instance.GetPartPreferredSize(g, this.Bounds, System.Windows.Forms.VisualStyles.ThemeSizeType.True); Point gripperLocation = new Point((int)(this.ControlBoundingRectangle.Width - sz.Width) / 2, (int)(this.ControlBoundingRectangle.Height - sz.Height) / 2); Rectangle arrowRect = new Rectangle(gripperLocation, sz); SystemSkinManager.Instance.PaintCurrentElement(g, arrowRect); } } }
private void PaintElementSkin(Graphics g, VisualStyles.VisualStyleElement element, Rectangle bounds) { if (SystemSkinManager.Instance.SetCurrentElement(element)) { SystemSkinManager.Instance.PaintCurrentElement(g, bounds); } }
public void SetTheme(VisualStyleElement element) { if (VisualStyleRenderer.IsSupported && VisualStyleRenderer.IsElementDefined(element)) rnd = new VisualStyleRenderer(element); else rnd = null; }
private static void DrawThemeBackground(IDeviceContext dc, VisualStyleElement element, Rectangle bounds, Rectangle clipRectangle) { if( DialogHelper.IsTaskDialogThemeSupported ) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(dc, bounds, clipRectangle); } }
public NativeStyleRenderer(IntPtr handle, VisualStyleElement element) { if (element == null) throw new ArgumentNullException("element", "element is null."); _theme = UxTheme.OpenTheme(handle, element.ClassName); _partId = element.Part; _stateId = element.State; }
public mainInstructionsLabel() { ForeColor = Color.FromArgb(0, 51, 153); Font = new Font(SystemFonts.MessageBoxFont.FontFamily.Name, 12f, GraphicsUnit.Point); _isVisualStyleSupported = (Environment.OSVersion.Version.Major >= 6 && VisualStyleRenderer.IsSupported); if (_isVisualStyleSupported) _vseMainInstruction = VisualStyleElement.CreateElement("TEXTSTYLE", 1, 0); }
/// <summary> /// Gets (or creates and caches) a <see cref="VSR"/> for the given <see cref="VSE"/>. /// </summary> /// <param name="element">The <see cref="VSE"/> to get a renderer for.</param> /// <returns>The <see cref="VSR"/>.</returns> public VSR GetCachedRenderer(VSE element) { if (!_cache.ContainsKey(element)) { _cache[element] = new VSR(element); } return(_cache[element]); }
public static Color GetColor(VisualStyleElement element, ColorProperty colorProperty, Color defaultColor) { if(VisualStyleRenderer.IsSupported && VisualStyleRenderer.IsElementDefined(element)) { return new VisualStyleRenderer(element).GetColor(colorProperty); } else { return defaultColor; } }
private static void InitializeRenderer(VisualStyleElement element) { if (visualStyleRenderer == null) { visualStyleRenderer = new VisualStyleRenderer(element); } else { visualStyleRenderer.SetParameters(element); } }
public Toast(Account account) { InitializeComponent(); this.Account = account; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.UpdateStyles(); int enabled = 0; int response = DwmIsCompositionEnabled(ref enabled); _aeroEnabled = enabled == 1; this.Opacity = 0; _closeTimer.Tick += delegate(object sender, EventArgs e) { this.Close(); }; _elementClose = VisualStyleElement.Window.SmallCloseButton.Normal; _elementPrev = VisualStyleElement.CreateElement("TaskbandExtendedUI", LeftControl, 1); _elementInbox = VisualStyleElement.CreateElement("TaskbandExtendedUI", CenterControl, 1); _elementNext = VisualStyleElement.CreateElement("TaskbandExtendedUI", RightControl, 1); _iconPrev = ResourceHelper.GetIcon("Previous.ico"); _iconInbox = ResourceHelper.GetIcon("Inbox.ico"); _iconNext = ResourceHelper.GetIcon("Next.ico"); _iconWindow = ResourceHelper.GetIcon("gmail-classic.ico", 16); ToolTip openTip = new ToolTip(); openTip.SetToolTip(_PictureOpen, Locale.Current.Tooltips.OpenMail); _PictureOpen.Cursor = Cursors.Hand; _PictureOpen.Click += OpenEmail; using (Icon icon = ResourceHelper.GetIcon("Open.ico")) { _PictureOpen.Image = icon.ToBitmap(); } if (this.Account.Emails.Count > 1) { _stateNext = State.Normal; } // show the last (newest) email _mailIndex = this.Account.Emails.Count - 1; UpdateBody(); }
public static bool IsElementDefined (VisualStyleElement element) { if (!IsSupported) throw new InvalidOperationException ("Visual Styles are not enabled."); if (IsElementKnownToBeSupported (element.ClassName, element.Part, element.State)) return true; IntPtr theme = VisualStyles.UxThemeOpenThemeData (IntPtr.Zero, element.ClassName); if (theme == IntPtr.Zero) return false; bool retval = VisualStyles.UxThemeIsThemePartDefined (theme, element.Part); VisualStyles.UxThemeCloseThemeData (theme); return retval; }
static ListItemRenderer() { if (!VisualStyleRenderer.IsSupported) { isSupported = false; return; } VisualStyleElement normal = VisualStyleElement.ListView.Item.Normal, hot = VisualStyleElement.ListView.Item.Hot, selected = VisualStyleElement.ListView.Item.Selected, disabled = VisualStyleElement.ListView.Item.Disabled, selectedNotFocus = VisualStyleElement.ListView.Item.SelectedNotFocus; isSupported = VisualStyleRenderer.IsElementDefined(normal) && VisualStyleRenderer.IsElementDefined(hot) && VisualStyleRenderer.IsElementDefined(selected) && VisualStyleRenderer.IsElementDefined(disabled) && VisualStyleRenderer.IsElementDefined(selectedNotFocus); if (isSupported) { baseElement = normal; return; } normal = VisualStyleElement.CreateElement("Explorer::ListView", 1, (int)ListViewItemState.Normal); hot = VisualStyleElement.CreateElement("Explorer::ListView", 1, (int)ListViewItemState.Hot); selected = VisualStyleElement.CreateElement("Explorer::ListView", 1, (int)ListViewItemState.Selected); disabled = VisualStyleElement.CreateElement("Explorer::ListView", 1, (int)ListViewItemState.Disabled); selectedNotFocus = VisualStyleElement.CreateElement("Explorer::ListView", 1, (int)ListViewItemState.SelectedNotFocus); isSupported = VisualStyleRenderer.IsElementDefined(normal) && VisualStyleRenderer.IsElementDefined(hot) && VisualStyleRenderer.IsElementDefined(selected) && VisualStyleRenderer.IsElementDefined(disabled) && VisualStyleRenderer.IsElementDefined(selectedNotFocus); if (isSupported) { baseElement = normal; return; } }
public static void DrawText(IDeviceContext dc, string text, VisualStyleElement element, Font fallbackFont, ref Point location, bool measureOnly, int width) { // For Windows 2000, using Int32.MaxValue for the height doesn't seem to work, so we'll just pick another arbitrary large value // that does work. Rectangle textRect = new Rectangle(location.X, location.Y, width, NativeMethods.IsWindowsXPOrLater ? Int32.MaxValue : 100000); TextFormatFlags flags = TextFormatFlags.WordBreak; if( IsTaskDialogThemeSupported ) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); Rectangle textSize = renderer.GetTextExtent(dc, textRect, text, flags); location = location + new Size(0, textSize.Height); if( !measureOnly ) renderer.DrawText(dc, textSize, text, false, flags); } else { if( !measureOnly ) TextRenderer.DrawText(dc, text, fallbackFont, textRect, SystemColors.WindowText, flags); Size textSize = TextRenderer.MeasureText(dc, text, fallbackFont, new Size(textRect.Width, textRect.Height), flags); location = location + new Size(0, textSize.Height); } }
private static void InitializeRenderer(VisualStyleElement element, int state) { if (visualStyleRenderer == null) { visualStyleRenderer = new VisualStyleRenderer(element.ClassName, element.Part, state); } else { visualStyleRenderer.SetParameters(element.ClassName, element.Part, state); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Returns a value indicating whether or not visual style rendering is supported /// in the application and if the specified element can be rendered. /// </summary> /// ------------------------------------------------------------------------------------ public static bool CanPaintVisualStyle(VisualStyleElement element) { return (CanPaintVisualStyle() && VisualStyleRenderer.IsElementDefined(element)); }
static void ManagedWindowGetBorderVisualStyleElements (InternalWindowManager wm, out VisualStyleElement left, out VisualStyleElement right, out VisualStyleElement bottom) { bool active = !ManagedWindowIsDisabled (wm) && ManagedWindowIsActive (wm); if (wm.IsToolWindow) { if (active) { left = VisualStyleElement.Window.SmallFrameLeft.Active; right = VisualStyleElement.Window.SmallFrameRight.Active; bottom = VisualStyleElement.Window.SmallFrameBottom.Active; } else { left = VisualStyleElement.Window.SmallFrameLeft.Inactive; right = VisualStyleElement.Window.SmallFrameRight.Inactive; bottom = VisualStyleElement.Window.SmallFrameBottom.Inactive; } } else { if (active) { left = VisualStyleElement.Window.FrameLeft.Active; right = VisualStyleElement.Window.FrameRight.Active; bottom = VisualStyleElement.Window.FrameBottom.Active; } else { left = VisualStyleElement.Window.FrameLeft.Inactive; right = VisualStyleElement.Window.FrameRight.Inactive; bottom = VisualStyleElement.Window.FrameBottom.Inactive; } } }
static bool AreEqual (VisualStyleElement value1, VisualStyleElement value2) { return value1.ClassName == value1.ClassName && value1.Part == value2.Part && value1.State == value2.State; }
private static bool IsDefined(VisualStyleElement element) { return Application.RenderWithVisualStyles && SafeNativeMethods.IsThemePartDefined(element.ClassName, element.Part, element.State); }
/// <summary> /// Returns a renderer for the given element. /// </summary> private VisualStyleRenderer GetRenderer(VisualStyleElement e) { if (VisualStyleRenderer.IsElementDefined(e)) return new VisualStyleRenderer(e); else return null; }
/// <summary> /// Gets the System.Windows.Forms.VisualStyles.VisualStyleRenderer to draw the specified element. /// </summary> /// <param name="element"></param> /// <returns></returns> public System.Windows.Forms.VisualStyles.VisualStyleRenderer GetRenderer(VisualStyleElement element) { return new System.Windows.Forms.VisualStyles.VisualStyleRenderer(element); }
/// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.VisualStyleRenderer"]/*' /> /// <devdoc> /// <para> /// Constructor takes a VisualStyleElement. /// </para> /// </devdoc> public VisualStyleRenderer(VisualStyleElement element) : this(element.ClassName, element.Part, element.State) { }
public Toast(Account account) { InitializeComponent(); this.Account = account; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.UpdateStyles(); if (!VisualStyleRenderer.IsSupported) { this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.ControlBox = true; this.Icon = Program.MainForm.Icon; } int enabled = 0; int response = DwmIsCompositionEnabled(ref enabled); _aeroEnabled = enabled == 1; this.Opacity = 0; //this.TopMost = true; SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSIZE | SetWindowPosFlags.NOREPOSITION); _closeTimer.Tick += delegate(object sender, EventArgs e) { this.Close(); }; _elementClose = VisualStyleElement.Window.SmallCloseButton.Normal; _elementPrev = VisualStyleElement.CreateElement("TaskbandExtendedUI", LeftControl, 1); _elementInbox = VisualStyleElement.CreateElement("TaskbandExtendedUI", CenterControl, 1); _elementNext = VisualStyleElement.CreateElement("TaskbandExtendedUI", RightControl, 1); _iconPrev = Resources.Icons.Previous; _iconInbox = Resources.Icons.Inbox; _iconNext = Resources.Icons.Next; _iconWindow = Resources.Icons.Window; ToolTip openTip = new ToolTip(); openTip.SetToolTip(_PictureOpen, Localization.Locale.Current.Toast.ViewEmail); _PictureOpen.Cursor = Cursors.Hand; _PictureOpen.Click += OpenEmail; //using (Icon icon = ResourceHelper.GetIcon("Open.ico")) { _PictureOpen.Image = Resources.Icons.Open.ToBitmap(); //} if (this.Account.Emails.Count > 1) { _stateNext = State.Normal; } // show the last (newest) email _mailIndex = 0; //this.Account.Emails.Count - 1; UpdateBody(); }
private void PaintElement(Graphics g, VisualStyleElement element, Rectangle rect, int state) { if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer renderer = new VisualStyleRenderer(element.ClassName, element.Part, state); renderer.DrawBackground(g, rect); } else { ButtonState buttonState = ButtonState.Normal; if (state == State.Disabled) { buttonState = ButtonState.Inactive; } else if (state == State.Pressed) { buttonState = ButtonState.Pushed; } if (element == _elementClose) { ControlPaint.DrawCaptionButton(g, rect, CaptionButton.Close, buttonState); } else { ControlPaint.DrawButton(g, rect, buttonState); } } }
public ArrowElement(ScrollButton sb) { this.ScrollButton = sb; VSElement = null; if (VisualStyleInformation.IsSupportedByOS) { //OS�ŃT�|�[�g���Ȃ����VisualStyle�͐ݒ肵�Ȃ� if (sb == ScrollButton.Left) VSElement = VisualStyleElement.Spin.DownHorizontal.Hot; else if (sb == ScrollButton.Right) VSElement = VisualStyleElement.Spin.UpHorizontal.Hot; else if (sb == ScrollButton.Down) VSElement = VisualStyleElement.Spin.Down.Hot; else if (sb == ScrollButton.Up) VSElement = VisualStyleElement.Spin.Up.Hot; } }
protected override void OnRenderButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e) { System.Drawing.Rectangle rectangle1; System.Drawing.Graphics graphics1 = e.Graphics; Oranikle.Studio.Controls.CtrlTabStrip ctrlTabStrip = e.ToolStrip as Oranikle.Studio.Controls.CtrlTabStrip; Oranikle.Studio.Controls.CtrlTabStripButton ctrlTabStripButton = e.Item as Oranikle.Studio.Controls.CtrlTabStripButton; if ((ctrlTabStrip == null) || (ctrlTabStripButton == null)) { if (currentRenderer != null) { currentRenderer.DrawButtonBackground(e); return; } base.OnRenderButtonBackground(e); return; } bool flag1 = ctrlTabStripButton.Checked; bool flag2 = ctrlTabStripButton.Selected; int i1 = 0, i2 = 0; System.Drawing.Rectangle rectangle3 = ctrlTabStripButton.Bounds; int i3 = rectangle3.Width - 1; System.Drawing.Rectangle rectangle4 = ctrlTabStripButton.Bounds; int i4 = rectangle4.Height - 1; if (UseVS) { if (ctrlTabStrip.Orientation == System.Windows.Forms.Orientation.Horizontal) { if (!flag1) { i1 = 2; i4--; } else { i1 = 1; } rectangle1 = new System.Drawing.Rectangle(0, 0, i3, i4); } else { if (!flag1) { i2 = 2; i3--; } else { i2 = 1; } rectangle1 = new System.Drawing.Rectangle(0, 0, i4, i3); } using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(rectangle1.Width, rectangle1.Height)) { System.Windows.Forms.VisualStyles.VisualStyleElement visualStyleElement = System.Windows.Forms.VisualStyles.VisualStyleElement.Tab.TabItem.Normal; if (flag1) { visualStyleElement = System.Windows.Forms.VisualStyles.VisualStyleElement.Tab.TabItem.Pressed; } if (flag2) { visualStyleElement = System.Windows.Forms.VisualStyles.VisualStyleElement.Tab.TabItem.Hot; } if (!ctrlTabStripButton.Enabled) { visualStyleElement = System.Windows.Forms.VisualStyles.VisualStyleElement.Tab.TabItem.Disabled; } if (!flag1 || flag2) { rectangle1.Width++; } else { rectangle1.Height++; } using (System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(bitmap)) { System.Windows.Forms.VisualStyles.VisualStyleRenderer visualStyleRenderer = new System.Windows.Forms.VisualStyles.VisualStyleRenderer(visualStyleElement); visualStyleRenderer.DrawBackground(graphics2, rectangle1); if (ctrlTabStrip.Orientation == System.Windows.Forms.Orientation.Vertical) { if (Mirrored) { bitmap.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone); } else { bitmap.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone); } } else if (Mirrored) { bitmap.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipX); } if (Mirrored) { System.Drawing.Rectangle rectangle5 = ctrlTabStripButton.Bounds; i2 = rectangle5.Width - bitmap.Width - i2; System.Drawing.Rectangle rectangle6 = ctrlTabStripButton.Bounds; i1 = rectangle6.Height - bitmap.Height - i1; } graphics1.DrawImage(bitmap, i2, i1); } return; } } if (ctrlTabStrip.Orientation == System.Windows.Forms.Orientation.Horizontal) { if (!flag1) { i1 = ctrlTabStripButton.VerticalOffsetInactive; i4 -= ctrlTabStripButton.VerticalOffsetInactive - 1; } else { i1 = ctrlTabStripButton.VerticalOffset; } if (Mirrored) { i2 = 1; i1 = 0; } else { i1++; } i3--; } else { if (!flag1) { i2 = 2; i3--; } else { i2 = 1; } if (Mirrored) { i2 = 0; i1 = 1; } } i4--; rectangle1 = new System.Drawing.Rectangle(i2, i1, i3, i4); using (System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath()) { if (Mirrored && (ctrlTabStrip.Orientation == System.Windows.Forms.Orientation.Horizontal)) { graphicsPath.AddLine(rectangle1.Left, rectangle1.Top, rectangle1.Left, rectangle1.Bottom - 2); graphicsPath.AddArc(rectangle1.Left, rectangle1.Bottom - 3, 2, 2, 90.0F, 90.0F); graphicsPath.AddLine(rectangle1.Left + 2, rectangle1.Bottom, rectangle1.Right - 2, rectangle1.Bottom); graphicsPath.AddArc(rectangle1.Right - 2, rectangle1.Bottom - 3, 2, 2, 0.0F, 90.0F); graphicsPath.AddLine(rectangle1.Right, rectangle1.Bottom - 2, rectangle1.Right, rectangle1.Top); } else if (!Mirrored && (ctrlTabStrip.Orientation == System.Windows.Forms.Orientation.Horizontal)) { int i5 = 1, i6 = 3; graphicsPath.AddLine(rectangle1.Left, rectangle1.Bottom, rectangle1.Left, rectangle1.Top + i6); graphicsPath.AddArc(rectangle1.Left, rectangle1.Top + i6 - 1, i6, i6, 180.0F, 90.0F); graphicsPath.AddLine(rectangle1.Left + i6, rectangle1.Top, rectangle1.Right - i6 - i5, rectangle1.Top); graphicsPath.AddArc(rectangle1.Right - i6 - i5, rectangle1.Top + i6 - 1, i6, i6, 270.0F, 90.0F); graphicsPath.AddLine(rectangle1.Right - i5, rectangle1.Top + i6, rectangle1.Right - i5, rectangle1.Bottom); } else if (Mirrored && (ctrlTabStrip.Orientation == System.Windows.Forms.Orientation.Vertical)) { graphicsPath.AddLine(rectangle1.Left, rectangle1.Top, rectangle1.Right - 2, rectangle1.Top); graphicsPath.AddArc(rectangle1.Right - 2, rectangle1.Top + 1, 2, 2, 270.0F, 90.0F); graphicsPath.AddLine(rectangle1.Right, rectangle1.Top + 2, rectangle1.Right, rectangle1.Bottom - 2); graphicsPath.AddArc(rectangle1.Right - 2, rectangle1.Bottom - 3, 2, 2, 0.0F, 90.0F); graphicsPath.AddLine(rectangle1.Right - 2, rectangle1.Bottom, rectangle1.Left, rectangle1.Bottom); } else { graphicsPath.AddLine(rectangle1.Right, rectangle1.Top, rectangle1.Left + 2, rectangle1.Top); graphicsPath.AddArc(rectangle1.Left, rectangle1.Top + 1, 2, 2, 180.0F, 90.0F); graphicsPath.AddLine(rectangle1.Left, rectangle1.Top + 2, rectangle1.Left, rectangle1.Bottom - 2); graphicsPath.AddArc(rectangle1.Left, rectangle1.Bottom - 3, 2, 2, 90.0F, 90.0F); graphicsPath.AddLine(rectangle1.Left + 2, rectangle1.Bottom, rectangle1.Right, rectangle1.Bottom); } System.Drawing.Color color1 = ctrlTabStripButton.BackColorInactive; if (flag1) { color1 = ctrlTabStripButton.BackColor; } else if (flag2) { color1 = ctrlTabStripButton.BackColorHot; } System.Drawing.Color color2 = ctrlTabStripButton.BackColor2Inactive; if (flag1) { color2 = ctrlTabStripButton.BackColor2; } else if (flag2) { color2 = ctrlTabStripButton.BackColor2Hot; } if (renderMode == System.Windows.Forms.ToolStripRenderMode.Professional) { color1 = flag2 ? System.Windows.Forms.ProfessionalColors.ButtonCheckedGradientBegin : System.Windows.Forms.ProfessionalColors.ButtonCheckedGradientEnd; using (System.Drawing.Drawing2D.LinearGradientBrush linearGradientBrush1 = new System.Drawing.Drawing2D.LinearGradientBrush(ctrlTabStripButton.ContentRectangle, color1, System.Windows.Forms.ProfessionalColors.ButtonCheckedGradientMiddle, System.Drawing.Drawing2D.LinearGradientMode.Vertical)) { graphics1.FillPath(linearGradientBrush1, graphicsPath); goto label_1; } } using (System.Drawing.Drawing2D.LinearGradientBrush linearGradientBrush2 = new System.Drawing.Drawing2D.LinearGradientBrush(ctrlTabStripButton.ContentRectangle, color1, color2, System.Drawing.Drawing2D.LinearGradientMode.Vertical)) { graphics1.FillPath(linearGradientBrush2, graphicsPath); } label_1: if (flag1) { using (System.Drawing.Pen pen1 = new System.Drawing.Pen(ctrlTabStripButton.BorderColor)) { graphics1.DrawPath(pen1, graphicsPath); goto label_2; } } if (flag2) { using (System.Drawing.Pen pen2 = new System.Drawing.Pen(ctrlTabStripButton.BorderColorHot)) { graphics1.DrawPath(pen2, graphicsPath); goto label_2; } } using (System.Drawing.Pen pen3 = new System.Drawing.Pen(ctrlTabStripButton.BorderColorInactive)) { graphics1.DrawPath(pen3, graphicsPath); } label_2: if (ctrlTabStripButton.ShowCloseButton) { System.Drawing.Image image = Oranikle.Studio.Controls.Properties.Resources.Icon_Close_Disabled_16; if (flag2) { image = Oranikle.Studio.Controls.Properties.Resources.Icon_Close_16; } System.Drawing.Rectangle rectangle2 = new System.Drawing.Rectangle(i2 + i3 - ctrlTabStripButton.CloseButtonHorizontalOffset, ctrlTabStripButton.CloseButtonVerticalOffset, 8, 8); graphics1.DrawImage(image, rectangle2); } } }
private VisualStyleElement Subclass(VisualStyleElement element) { return VisualStyleElement.CreateElement(SubclassPrefix + element.ClassName, element.Part, element.State); }
private bool SetRenderer(VisualStyleElement element) { if (!VisualStyleRenderer.IsElementDefined(element)) { return false; } if (renderer == null) { renderer = new VisualStyleRenderer(element); } else { renderer.SetParameters(element); } return true; }
/// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.SetParameters"]/*' /> /// <devdoc> /// <para> /// Used to set a new VisualStyleElement on this VisualStyleRenderer instance. /// </para> /// </devdoc> public void SetParameters(VisualStyleElement element) { if (element == null) { throw new ArgumentNullException("element"); } SetParameters(element.ClassName, element.Part, element.State); }
private bool SetRenderer(VisualStyleElement element) { if (!Application.RenderWithVisualStyles) return false; if (!VisualStyleRenderer.IsElementDefined(element)) return false; if (_renderer == null) _renderer = new VisualStyleRenderer(element); else _renderer.SetParameters(element); return true; }
/// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.IsCombinationDefined"]/*' /> /// <devdoc> /// <para> /// Returns true if the element is defined by the current visual style, else false. /// Note: /// 1) Throws an exception if IsSupported is false, since it is illegal to call it in that case. /// 2) The underlying API does not validate states. So if you pass in invalid state values, /// we might still return true. When you use an invalid state to render, you get the default /// state instead. /// </para> /// </devdoc> public static bool IsElementDefined(VisualStyleElement element) { if (element == null) { throw new ArgumentNullException("element"); } return IsCombinationDefined(element.ClassName, element.Part); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Returns a value indicating whether or not visual style rendering is supported /// in the application and if the specified element can be rendered. /// </summary> /// ------------------------------------------------------------------------------------ public static bool CanPaintVisualStyle(VisualStyleElement element) { return (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(element)); }
public void SetParameters (VisualStyleElement element) { this.SetParameters (element.ClassName, element.Part, element.State); }