本文整理汇总了C#中System.Drawing.Icon类的典型用法代码示例。如果您正苦于以下问题:C# Icon类的具体用法?C# Icon怎么用?C# Icon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Icon类属于System.Drawing命名空间,在下文中一共展示了Icon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NetSparkleForm
/// <summary>
/// Constructor
/// </summary>
/// <param name="items">List of updates to show</param>
/// <param name="applicationIcon">The icon</param>
/// <param name="separatorTemplate">HTML template for every single note. Use {0} = Version. {1} = Date. {2} = Note Body</param>
/// <param name="headAddition">Additional text they will inserted into HTML Head. For Stylesheets.</param>
public NetSparkleForm(Sparkle sparkle, NetSparkleAppCastItem[] items, Icon applicationIcon = null, string separatorTemplate = "", string headAddition = "")
{
_sparkle = sparkle;
_updates = items;
SeparatorTemplate =
!string.IsNullOrEmpty(separatorTemplate) ?
separatorTemplate :
"<div style=\"border: #ccc 1px solid;\"><div style=\"background: {3}; padding: 5px;\"><span style=\"float: right; display:float;\">{1}</span>{0}</div><div style=\"padding: 5px;\">{2}</div></div><br>";
InitializeComponent();
// init ui
try
{
NetSparkleBrowser.AllowWebBrowserDrop = false;
NetSparkleBrowser.AllowNavigation = false;
}
catch (Exception ex)
{
Debug.WriteLine("Error in browser init: " + ex.Message);
}
NetSparkleAppCastItem item = items[0];
lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName);
lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version);
lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", getVersion(new Version(item.AppVersionInstalled)));
if (items.Length == 0)
{
RemoveReleaseNotesControls();
}
else
{
NetSparkleAppCastItem latestVersion = _updates.OrderByDescending(p => p.Version).FirstOrDefault();
StringBuilder sb = new StringBuilder("<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>" + headAddition + "</head><body>");
foreach (NetSparkleAppCastItem castItem in items)
{
sb.Append(string.Format(SeparatorTemplate,
castItem.Version,
castItem.PublicationDate.ToString("dd MMM yyyy"),
GetReleaseNotes(castItem),
latestVersion.Version.Equals(castItem.Version) ? "#ABFF82" : "#AFD7FF"));
}
sb.Append("</body>");
string releaseNotes = sb.ToString();
NetSparkleBrowser.DocumentText = releaseNotes;
}
if (applicationIcon != null)
{
imgAppIcon.Image = new Icon(applicationIcon, new Size(48, 48)).ToBitmap();
Icon = applicationIcon;
}
TopMost = false;
}
示例2: Main
public Main(string[] args)
{
InitializeComponent();
this.Location = new Point(-10000, -10000);
//using (System.Drawing.Bitmap windowBitmap = ResourceHelper.GetImage("Envelope.png")) {
// _IconWindow = Icon.FromHandle(windowBitmap.GetHicon());
// this.Icon = _IconWindow;
//}
_IconWindow = ResourceHelper.GetIcon("gmail-classic.ico");
this.Icon = _IconWindow;
this.Text = this._TrayIcon.Text = GmailNotifierPlus.Resources.WindowTitle;
this.CreateInstances();
if (args.Length > 0 && args[0] == Program.Arguments.Settings){
this.OpenSettingsWindow();
}
_Config.Saved += _Config_Saved;
_Timer.Tick += _Timer_Tick;
_Timer.Interval = _Config.Interval * 1000;
_Timer.Enabled = true;
}
示例3: LeanEngineWinForm
/// <summary>
/// Launch the Lean Engine Primary Form:
/// </summary>
/// <param name="engine">Accept the engine instance we just launched</param>
public LeanEngineWinForm(Engine engine)
{
_engine = engine;
//Setup the State:
_resultsHandler = engine.AlgorithmHandlers.Results;
//Create Form:
Text = "QuantConnect Lean Algorithmic Trading Engine: v" + Constants.Version;
Size = new Size(1024,768);
MinimumSize = new Size(1024, 768);
CenterToScreen();
WindowState = FormWindowState.Maximized;
Icon = new Icon("../../../lean.ico");
//Setup Console Log Area:
_console = new RichTextBox();
_console.Parent = this;
_console.ReadOnly = true;
_console.Multiline = true;
_console.Location = new Point(0, 0);
_console.Dock = DockStyle.Fill;
_console.KeyUp += ConsoleOnKeyUp;
//Form Events:
Closed += OnClosed;
//Setup Polling Events:
_polling = new Timer();
_polling.Interval = 1000;
_polling.Tick += PollingOnTick;
_polling.Start();
}
示例4: SymbologyMenuItem
/// <summary>
/// Creates a new instance of the menu item
/// </summary>
/// <param name="name">The name or text to appear for this item</param>
/// <param name="icon">The icon to draw for this menu item</param>
/// <param name="clickHandler">The click event handler</param>
public SymbologyMenuItem(string name, Icon icon, EventHandler clickHandler)
{
MenuItems = new List<SymbologyMenuItem>();
Name = name;
ClickHandler = clickHandler;
Icon = icon;
}
示例5: Form1
public Form1()
{
_heartbeat = 0;
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
icnStopped = Resources.Icon1;
icnStarted = Resources.Icon2;
timestamp = RetrieveLinkerTimestamp();
Assembly _assembly;
_assembly = Assembly.GetExecutingAssembly();
// notifyIcon1.Text = "MTC Multi-SHDR Agent - Release " + _assembly.ImageRuntimeVersion ;
notifyIcon1.Text = "MTC Agent Simulator - Release " + timestamp.ToLocalTime(); ;
notifyIcon1.Icon = icnStopped;
Logger.RestartLog();
aTimer = new System.Timers.Timer();
aTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
// System.Threading.Thread.Sleep(30000);
MTConnectAgentCore.Configuration.defaultDirectory = Application.StartupPath + "\\";
MTConnectAgentCore.Configuration.confDirectory = "" ;
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
}
示例6: LoadBitmap
private static BitmapSource LoadBitmap(Icon icon)
{
return (icon == null) ? null :
System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
icon.ToBitmap().GetHbitmap(), IntPtr.Zero, Int32Rect.Empty,
System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
}
示例7: Player
/// <summary>
/// A media player that is controlled from a notify icon
/// using the mouse. Takes control of the notifyicon icon,
/// tooltip and balloon to display status.
/// </summary>
/// <param name="icon">
/// The notify icon that controls playback.
/// </param>
public Player(NotifyIcon icon)
{
notifyIcon = icon;
notifyIcon.MouseClick += OnMouseClick;
player = new MediaPlayer();
player.BufferingStarted += OnBufferingStarted;
player.BufferingEnded += OnBufferingEnded;
player.MediaEnded += OnMediaEnded;
player.MediaFailed += OnMediaFailed;
source = null;
isIdle = true;
idleIcon = Utils.ResourceAsIcon("GaGa.Resources.idle.ico");
playingIcon = Utils.ResourceAsIcon("GaGa.Resources.playing.ico");
playingMutedIcon = Utils.ResourceAsIcon("GaGa.Resources.playing-muted.ico");
bufferingIcons = new Icon[] {
Utils.ResourceAsIcon("GaGa.Resources.buffering1.ico"),
Utils.ResourceAsIcon("GaGa.Resources.buffering2.ico"),
Utils.ResourceAsIcon("GaGa.Resources.buffering3.ico"),
Utils.ResourceAsIcon("GaGa.Resources.buffering4.ico"),
};
bufferingIconTimer = new DispatcherTimer();
bufferingIconTimer.Interval = TimeSpan.FromMilliseconds(300);
bufferingIconTimer.Tick += bufferingIconTimer_Tick;
currentBufferingIcon = 0;
UpdateIcon();
}
示例8: SetUpFixture
public void SetUpFixture()
{
resourceWriter = new MockResourceWriter();
componentCreator = new MockComponentCreator();
componentCreator.SetResourceWriter(resourceWriter);
using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
IEventBindingService eventBindingService = new MockEventBindingService(host);
host.AddService(typeof(IResourceService), componentCreator);
Form form = (Form)host.RootComponent;
form.ClientSize = new Size(200, 300);
PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
namePropertyDescriptor.SetValue(form, "MainForm");
// Add ImageList.
icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico");
ImageList imageList = (ImageList)host.CreateComponent(typeof(ImageList), "imageList1");
imageList.Images.Add("App.ico", icon);
imageList.Images.Add("", icon);
imageList.Images.Add("", icon);
DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
using (serializationManager.CreateSession()) {
RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" ");
generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1);
}
}
}
示例9: NetSparkleForm
/// <summary>
/// Constructor
/// </summary>
/// <param name="item"></param>
/// <param name="appIcon"></param>
/// <param name="windowIcon"></param>
public NetSparkleForm(NetSparkleAppCastItem item, Image appIcon, Icon windowIcon)
{
InitializeComponent();
// init ui
try
{
NetSparkleBrowser.AllowWebBrowserDrop = false;
NetSparkleBrowser.AllowNavigation = false;
}
catch (Exception)
{ }
_currentItem = item;
lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName);
lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version);
lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", item.AppVersionInstalled);
if (!string.IsNullOrEmpty(item.ReleaseNotesLink) )
NetSparkleBrowser.Navigate(item.ReleaseNotesLink);
else
RemoveReleaseNotesControls();
if (appIcon != null)
imgAppIcon.Image = appIcon;
if (windowIcon != null)
Icon = windowIcon;
this.TopMost = true;
}
示例10: HotKeys
public HotKeys(Icon icon, DataTable dataTable)
{
InitializeComponent();
this.Icon = icon;
DvKeys.DataSource = dataTable;
}
示例11: ConvertFromIcon
private static BitmapFrame ConvertFromIcon(Icon icon)
{
var memoryStream = new MemoryStream();
icon.Save(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
return BitmapFrame.Create(memoryStream);
}
示例12: Button
public Button(string displayName, string internalName, CommandTypesEnum commandType, string clientId, string description, string tooltip, Icon standardIcon, Icon largeIcon, ButtonDisplayEnum buttonDisplayType)
{
try
{
//get IPictureDisp for icons
stdole.IPictureDisp standardIconIPictureDisp;
standardIconIPictureDisp = (stdole.IPictureDisp)Support.IconToIPicture(standardIcon);
stdole.IPictureDisp largeIconIPictureDisp;
largeIconIPictureDisp = (stdole.IPictureDisp)Support.IconToIPicture(largeIcon);
//create button definition
m_buttonDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition(displayName, internalName, commandType, clientId, description, tooltip, standardIconIPictureDisp , largeIconIPictureDisp, buttonDisplayType);
//enable the button
m_buttonDefinition.Enabled = true;
//connect the button event sink
ButtonDefinition_OnExecuteEventDelegate = new ButtonDefinitionSink_OnExecuteEventHandler(ButtonDefinition_OnExecute);
m_buttonDefinition.OnExecute += ButtonDefinition_OnExecuteEventDelegate;
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}
}
示例13: SetUpFixture
public void SetUpFixture()
{
resourceWriter = new MockResourceWriter();
componentCreator = new MockComponentCreator();
componentCreator.SetResourceWriter(resourceWriter);
using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
IEventBindingService eventBindingService = new MockEventBindingService(host);
host.AddService(typeof(IResourceService), componentCreator);
Form form = (Form)host.RootComponent;
form.ClientSize = new Size(200, 300);
PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
namePropertyDescriptor.SetValue(form, "MainForm");
// Set bitmap as form background image.
bitmap = new Bitmap(10, 10);
form.BackgroundImage = bitmap;
icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico");
form.Icon = icon;
DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
using (serializationManager.CreateSession()) {
PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" ");
generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1);
}
}
}
示例14: OnFormLoad
private void OnFormLoad(object sender, EventArgs e)
{
GlobalWindowManager.AddWindow(this, this);
m_lblCopyright.Text = PwDefs.Copyright + ".";
string strTitle = PwDefs.ProductName;
string strDesc = KPRes.Version + " " + PwDefs.VersionString;
Icon icoNew = new Icon(Properties.Resources.KeePass, 48, 48);
BannerFactory.CreateBannerEx(this, m_bannerImage, icoNew.ToBitmap(),
strTitle, strDesc);
this.Icon = Properties.Resources.KeePass;
m_lvComponents.Columns.Add(KPRes.Component, 100, HorizontalAlignment.Left);
m_lvComponents.Columns.Add(KPRes.Status + " / " + KPRes.Version, 100,
HorizontalAlignment.Left);
try { GetAppComponents(); }
catch(Exception) { Debug.Assert(false); }
UIUtil.SetExplorerTheme(m_lvComponents, false);
UIUtil.ResizeColumns(m_lvComponents, true);
}
示例15: CreateButtonDefinition
void CreateButtonDefinition()
{
System.Reflection.Assembly currentAssembly = System.Reflection.Assembly
.GetExecutingAssembly();
System.IO.Stream centerPtRectangleButtonPath = currentAssembly
.GetManifestResourceStream
("QubeItTools.Resources.Vertical Mid Point Rectangle.ico");
int largeIconSize = 32;
int standardIconSize = 16;
Icon VerticalMidPointRectangleIcon = new Icon(centerPtRectangleButtonPath);
Icon largeVerticalMidPointRectangleIcon = new Icon(VerticalMidPointRectangleIcon, largeIconSize,
largeIconSize);
Icon standardVerticalMidPointRectangleIcon = new Icon(VerticalMidPointRectangleIcon,
standardIconSize, standardIconSize);
stdole.IPictureDisp largeIconPictureDisp =
(stdole.IPictureDisp)Support.IconToIPicture(largeVerticalMidPointRectangleIcon);
stdole.IPictureDisp standardIconPictureDisp =
(stdole.IPictureDisp)Support.IconToIPicture(standardVerticalMidPointRectangleIcon);
ButtonDefinition = StandardAddInServer.InventorApplication.CommandManager.ControlDefinitions.
AddButtonDefinition("V.M.P.R.", ClientButtonInternalName,
CommandTypesEnum.kShapeEditCmdType, StandardAddInServer.AddInServerId,
"Create Vertical Mid Point Rectangle",
"Creates a rectangle that is constrained to the mid-point of one of the vertical lines",
standardIconPictureDisp, largeIconPictureDisp,
ButtonDisplayEnum.kDisplayTextInLearningMode);
ButtonDefinition.Enabled = true;
buttonPressed = ButtonDefinition.Pressed;
CommandIsRunning = false;
}