本文整理汇总了C#中System.Drawing.Icon类的典型用法代码示例。如果您正苦于以下问题:C# Icon类的具体用法?C# Icon怎么用?C# Icon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Icon类属于System.Drawing命名空间,在下文中一共展示了Icon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Deadpikle,项目名称:NetSparkle,代码行数:67,代码来源:NetSparkleForm.cs
示例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;
}
开发者ID:cadbusca,项目名称:Gmail-Notifier-Plus,代码行数:27,代码来源:Main.cs
示例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();
}
开发者ID:skyfyl,项目名称:Lean,代码行数:36,代码来源:LeanEngineWinForm.cs
示例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;
}
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:13,代码来源:SymbologyMenuItem.cs
示例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;
}
开发者ID:Wolfury,项目名称:MTConnect4OPC,代码行数:30,代码来源:Form1.cs
示例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());
}
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:7,代码来源:IconReaderService.cs
示例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();
}
开发者ID:JamieSharpe,项目名称:GaGa,代码行数:41,代码来源:Player.cs
示例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);
}
}
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:GenerateImageListResourceTestFixture.cs
示例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;
}
开发者ID:ashokgelal,项目名称:NetSparkle,代码行数:38,代码来源:NetSparkleForm.cs
示例10: HotKeys
public HotKeys(Icon icon, DataTable dataTable)
{
InitializeComponent();
this.Icon = icon;
DvKeys.DataSource = dataTable;
}
开发者ID:burstas,项目名称:rmps,代码行数:7,代码来源:HotKeys.cs
示例11: ConvertFromIcon
private static BitmapFrame ConvertFromIcon(Icon icon)
{
var memoryStream = new MemoryStream();
icon.Save(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
return BitmapFrame.Create(memoryStream);
}
开发者ID:olivierdagenais,项目名称:GoToWindow,代码行数:7,代码来源:DesignTimeMainViewModel.cs
示例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());
}
}
开发者ID:loanst,项目名称:Education-project,代码行数:26,代码来源:Button.cs
示例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);
}
}
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:GenerateFormResourcesTestFixture.cs
示例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);
}
开发者ID:riking,项目名称:go-keepass2,代码行数:25,代码来源:AboutForm.cs
示例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;
}
开发者ID:Hallmanac,项目名称:Rectangle-Tools-2010-2012,代码行数:34,代码来源:VertMidPointRectangleButton.cs
示例16: DomIcon
/// Methods
static DomIcon()
{
DomIcon.DomIcons = new Hashtable(0x10);
DomIcon.Images = new ImageList();
DomIcon.PropertyDocument = new XmlDocument();
DomIcon.Images = ResourceHelper.LoadBitmapStrip(Type.GetType("ItopVector.Resource.DomIcon"), "ItopVector.Resource.DomIcon.Bitmap1.bmp", new Size(0x10, 0x10), new Point(0, 0));
Assembly assembly1 = Assembly.GetAssembly(Type.GetType("ItopVector.Resource.DomIcon"));
string[] textArray1 = assembly1.GetManifestResourceNames();
string text1 = "ItopVector.Resource.DomIcon.";
string[] textArray2 = textArray1;
for (int num1 = 0; num1 < textArray2.Length; num1++)
{
string text2 = textArray2[num1];
if (text2.EndsWith(".ico") && (text2.IndexOf(text1) >= 0))
{
Stream stream1 = assembly1.GetManifestResourceStream(text2);
string text3 = text2.Substring(text1.Length, text2.Length - text1.Length);
text3 = text3.Substring(0, text3.Length - 4);
if (stream1 != null)
{
Icon icon1 = new Icon(stream1);
DomIcon.DomIcons.Add(text3, icon1);
}
}
}
assembly1 = Assembly.GetAssembly(Type.GetType("ItopVector.Resource.DomIcon"));
Stream stream2 = assembly1.GetManifestResourceStream("ItopVector.Resource.DomIcon.domimage.xml");
if (stream2 != null)
{
DomIcon.PropertyDocument.Load(stream2);
}
}
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:33,代码来源:DomIcon.cs
示例17: NetSparkleDownloadProgress
/// <summary>
/// Constructor
/// </summary>
/// <param name="sparkle">the sparkle instance</param>
/// <param name="item"></param>
/// <param name="appIcon">application icon</param>
/// <param name="windowIcon">window icon</param>
/// <param name="Unattend"><c>true</c> if this is an unattended install</param>
public NetSparkleDownloadProgress(Sparkle sparkle, NetSparkleAppCastItem item, Image appIcon, Icon windowIcon, Boolean Unattend)
{
InitializeComponent();
if (appIcon != null)
imgAppIcon.Image = appIcon;
if (windowIcon != null)
Icon = windowIcon;
// store the item
_sparkle = sparkle;
_item = item;
//_referencedAssembly = referencedAssembly;
_unattend = Unattend;
// init ui
btnInstallAndReLaunch.Visible = false;
lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName + " " + item.Version);
progressDownload.Maximum = 100;
progressDownload.Minimum = 0;
progressDownload.Step = 1;
// show the right
Size = new Size(Size.Width, 107);
lblSecurityHint.Visible = false;
}
开发者ID:ashokgelal,项目名称:NetSparkle,代码行数:35,代码来源:NetSparkleDownloadProgress.cs
示例18: LoadIcon
void LoadIcon()
{
string iconFile = "App.ico";
if (Files.Exists(iconFile))
Icon = new Icon(iconFile);
}
开发者ID:bberak,项目名称:Appy,代码行数:7,代码来源:App.cs
示例19: ReadFilesProperties
void ReadFilesProperties(object sender, DoWorkEventArgs e)
{
while(_itemsToRead.Count > 0)
{
BaseItem item = _itemsToRead[0];
_itemsToRead.RemoveAt(0);
Thread.Sleep(50); //emulate time consuming operation
if (item is FolderItem)
{
DirectoryInfo info = new DirectoryInfo(item.ItemPath);
item.Date = info.CreationTime;
}
else if (item is FileItem)
{
FileInfo info = new FileInfo(item.ItemPath);
item.Size = info.Length;
item.Date = info.CreationTime;
if (info.Extension.ToLower() == ".ico")
{
Icon icon = new Icon(item.ItemPath);
item.Icon = icon.ToBitmap();
}
else if (info.Extension.ToLower() == ".bmp")
{
item.Icon = new Bitmap(item.ItemPath);
}
}
_worker.ReportProgress(0, item);
}
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:31,代码来源:FolderBrowserModel.cs
示例20: HistoryWindow
/// <summary>
/// Constructor; loads the history data and gets the icons for each protocol.
/// </summary>
/// <param name="applicationForm">Main application for for this window.</param>
public HistoryWindow(MainForm applicationForm)
{
_applicationForm = applicationForm;
InitializeComponent();
_historyListView.ListViewItemSorter = new HistoryComparer(_connections);
// Get the icon for each protocol
foreach (IProtocol protocol in ConnectionFactory.GetProtocols())
{
Icon icon = new Icon(protocol.ProtocolIcon, 16, 16);
historyImageList.Images.Add(icon);
_connectionTypeIcons[protocol.ConnectionType] = historyImageList.Images.Count - 1;
}
// Load the history data
if (File.Exists(_historyFileName))
{
XmlSerializer historySerializer = new XmlSerializer(typeof (List<HistoricalConnection>));
List<HistoricalConnection> historicalConnections = null;
using (XmlReader historyReader = new XmlTextReader(_historyFileName))
historicalConnections = (List<HistoricalConnection>) historySerializer.Deserialize(historyReader);
foreach (HistoricalConnection historyEntry in historicalConnections)
AddToHistory(historyEntry);
}
}
开发者ID:nospy,项目名称:EasyConnect,代码行数:34,代码来源:HistoryWindow.cs
注:本文中的System.Drawing.Icon类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论