DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Layout
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents class with static functions that provide commonly used utility functions when working with
|
||||
/// Bar objects and items hosted by Bar object.
|
||||
/// </summary>
|
||||
internal class BarUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether StringFormat internally used by all DotNetBar controls to render text is GenericDefault. Default value is false
|
||||
/// which indicates that GenericTypographic is used.
|
||||
/// </summary>
|
||||
public static bool UseGenericDefaultStringFormat
|
||||
{
|
||||
get { return TextDrawing.UseGenericDefault; }
|
||||
set { TextDrawing.UseGenericDefault = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the anti-alias text rendering hint that will be used to render text on controls that have AntiAlias property set to true.
|
||||
/// </summary>
|
||||
public static TextRenderingHint AntiAliasTextRenderingHint
|
||||
{
|
||||
get
|
||||
{
|
||||
return DisplayHelp.AntiAliasTextRenderingHint;
|
||||
}
|
||||
set
|
||||
{
|
||||
DisplayHelp.AntiAliasTextRenderingHint = value;
|
||||
}
|
||||
}
|
||||
|
||||
#if FRAMEWORK20
|
||||
/// <summary>
|
||||
/// Gets or sets whether .NET Framework TextRenderer class is used for text rendering instead of Graphics.DrawString.
|
||||
/// Default value is false.
|
||||
/// Using TextRenderer will disable the Fade and Animation effects on controls because of issues in TextRenderer when drawing text on transparent
|
||||
/// surfaces.
|
||||
/// </summary>
|
||||
public static bool UseTextRenderer
|
||||
{
|
||||
get { return TextDrawing.UseTextRenderer; }
|
||||
set { TextDrawing.UseTextRenderer = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
private static bool _AlwaysGenerateAccessibilityFocusEvent = false;
|
||||
/// <summary>
|
||||
/// Gets or sets whether items always generate the Focus accessibility event when mouse enters the item. Default value is false which indicates
|
||||
/// that focus event will be raised only when item is on menu bar.
|
||||
/// </summary>
|
||||
public static bool AlwaysGenerateAccessibilityFocusEvent
|
||||
{
|
||||
get { return _AlwaysGenerateAccessibilityFocusEvent; }
|
||||
set
|
||||
{
|
||||
_AlwaysGenerateAccessibilityFocusEvent = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsModalFormOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
#if (FRAMEWORK20)
|
||||
for (int i = 0; i < System.Windows.Forms.Application.OpenForms.Count; i++)
|
||||
{
|
||||
System.Windows.Forms.Form form = System.Windows.Forms.Application.OpenForms[i];
|
||||
if (form.Modal) return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool _AutoRemoveMessageFilter = false;
|
||||
/// <summary>
|
||||
/// Gets or sets whether Application Message Filter that is registered by popup controls
|
||||
/// is automatically unregistered when last control is disposed. Default value is false and
|
||||
/// in most cases should not be changed.
|
||||
/// </summary>
|
||||
public static bool AutoRemoveMessageFilter
|
||||
{
|
||||
get { return _AutoRemoveMessageFilter; }
|
||||
set { _AutoRemoveMessageFilter = value; }
|
||||
}
|
||||
|
||||
private static int _TextMarkupCultureSpecific = 3;
|
||||
/// <summary>
|
||||
/// Get or sets the text-markup padding for text measurement when running on Japanese version of Windows.
|
||||
/// </summary>
|
||||
public static int TextMarkupCultureSpecificPadding
|
||||
{
|
||||
get { return _TextMarkupCultureSpecific; }
|
||||
set
|
||||
{
|
||||
_TextMarkupCultureSpecific = value;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool _DisposeItemImages = false;
|
||||
/// <summary>
|
||||
/// Gets or sets whether Image and Icon resources assigned to items and controls are automatically disposed when
|
||||
/// control or item is disposed. Default value is false.
|
||||
/// </summary>
|
||||
public static bool DisposeItemImages
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DisposeItemImages;
|
||||
}
|
||||
set
|
||||
{
|
||||
_DisposeItemImages = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes image reference and sets it to null.
|
||||
/// </summary>
|
||||
/// <param name="image">Reference to image to dispose.</param>
|
||||
internal static void DisposeImage(ref System.Drawing.Image image)
|
||||
{
|
||||
if (image == null) return;
|
||||
image.Dispose();
|
||||
image = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Disposes image reference and sets it to null.
|
||||
/// </summary>
|
||||
/// <param name="image">Reference to image to dispose.</param>
|
||||
internal static void DisposeImage(ref System.Drawing.Icon icon)
|
||||
{
|
||||
if (icon == null) return;
|
||||
icon.Dispose();
|
||||
icon = null;
|
||||
}
|
||||
|
||||
#region Delayed Invoke
|
||||
/// <summary>
|
||||
/// Invokes the method asynchronously using the WinForms Timer.
|
||||
/// </summary>
|
||||
/// <param name="method">Method to invoke.</param>
|
||||
public static void InvokeDelayed(MethodInvoker method)
|
||||
{
|
||||
InvokeDelayed(method, 10);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invokes the method asynchronously using the WinForms Timer.
|
||||
/// </summary>
|
||||
/// <param name="method">Method to invoke.</param>
|
||||
/// <param name="delayInterval">Time in milliseconds after which method is invoked.</param>
|
||||
public static void InvokeDelayed(MethodInvoker method, int delayInterval)
|
||||
{
|
||||
Timer delayedInvokeTimer = new Timer();
|
||||
delayedInvokeTimer = new Timer();
|
||||
delayedInvokeTimer.Tag = method;
|
||||
delayedInvokeTimer.Interval = delayInterval;
|
||||
delayedInvokeTimer.Tick += new EventHandler(DelayedInvokeTimerTick);
|
||||
delayedInvokeTimer.Start();
|
||||
}
|
||||
private static void DelayedInvokeTimerTick(object sender, EventArgs e)
|
||||
{
|
||||
Timer timer = (Timer)sender;
|
||||
MethodInvoker method = (MethodInvoker)timer.Tag;
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
method.Invoke();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal class BarPropertyBagKeys
|
||||
{
|
||||
public static string AutoHideSetting="autohide";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user