当前位置: 首页>>代码示例>>C#>>正文


C# Icon.ToBitmap方法代码示例

本文整理汇总了C#中System.Drawing.Icon.ToBitmap方法的典型用法代码示例。如果您正苦于以下问题:C# Icon.ToBitmap方法的具体用法?C# Icon.ToBitmap怎么用?C# Icon.ToBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Icon的用法示例。


在下文中一共展示了Icon.ToBitmap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: EditSimpleListPage

        public EditSimpleListPage(
                string pageID,
                string subjectName,
                Icon displayIcon,
                string ownerType,
                string subjectListRelationship,
                string memberType,
                GetSubjectDescriptionDelegate getSubjectDescription,
                GetListMembersDelegate getListMembers,
                DoAddMemberDelegate addMember,
                DoDelMemberDelegate delMember,
                EditDialog editDialog)
        {
            this.pageID = pageID;
            InitializeComponent();
            lbSubject.Text = String.Format(lbSubject.Text, subjectName);
            lbSubjectListRelationship.Text = String.Format(lbSubjectListRelationship.Text, subjectListRelationship);
            pbSubjectImage.Image = displayIcon.ToBitmap();
            this.getSubjectDescription = getSubjectDescription;
            this.getListMembers = getListMembers;
            this.addMember = addMember;
            this.delMember = delMember;

            this.listOwnerType = ownerType;
            this.listMemberType = memberType;

            this.editDialog = editDialog;

            this.tbDescription.Select();
        }
开发者ID:numberer6,项目名称:likewise-open-1,代码行数:30,代码来源:EditSimpleListPage.cs

示例3: 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);

			m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width,
				m_bannerImage.Height, BannerStyle.Default,
				icoNew.ToBitmap(), strTitle, strDesc);
			this.Icon = Properties.Resources.KeePass;

			m_lvComponents.Columns.Add(KPRes.Components, 100, HorizontalAlignment.Left);
			m_lvComponents.Columns.Add(KPRes.Version, 100, HorizontalAlignment.Left);

			try { GetAppComponents(); }
			catch(Exception) { Debug.Assert(false); }

			int nWidth = m_lvComponents.ClientRectangle.Width / 2;
			int nMod = m_lvComponents.ClientRectangle.Width % 2;
			m_lvComponents.Columns[0].Width = nWidth;
			m_lvComponents.Columns[1].Width = nWidth + nMod;

			UIUtil.SetExplorerTheme(m_lvComponents.Handle);
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:29,代码来源:AboutForm.cs

示例4: ComputeIconHash

 private byte[] ComputeIconHash(Icon icon)
 {
     ImageConverter converter = new ImageConverter();
     byte[] rawIcon = converter.ConvertTo(icon.ToBitmap(), typeof(byte[])) as byte[];
     MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
     return md5.ComputeHash(rawIcon);
 }
开发者ID:M4sterShake,项目名称:BitcoinPriceMonitor,代码行数:7,代码来源:NotificationTrayIconTests.cs

示例5: MessageForm

        public MessageForm(string caption, string message, string[] buttons, Icon icon)
        {
            InitializeComponent();

            int width = icon.Width;
            if (icon != null)
            {
                image_box.Image = (Image)icon.ToBitmap();
                int w = image_box.Image.Width - width;
                if (w > 0)
                {
                    this.Width += w;
                    this.message.Left += w;
                }
            }

            this.Text = caption;
            this.message.Text = message;

            for (int i = buttons.Length - 1; i >= 0; i--)
            {
                Button b = new Button();
                b.Tag = i;
                b.Text = buttons[i];
                b.Click += b_Click;
                flowLayoutPanel1.Controls.Add(b);
                if (i == 0)
                    b.Select();
            }
        }
开发者ID:sergeystoyan,项目名称:FhrCliverHost,代码行数:30,代码来源:MessageForm.cs

示例6: PostHttp

 public PostHttp()
 {
     this.settings = new Settings(AddonPath + "/settings.txt");
       Icon icon = new Icon(AddonPath + "/Icon.ico");
       this.bmpIcon = icon.ToBitmap();
       this.bmpIcon16 = new Icon(icon, new Size(16, 16)).ToBitmap();
 }
开发者ID:jamesmanning,项目名称:Clipupload,代码行数:7,代码来源:PostHttp.cs

示例7: 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

示例8: 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

示例9: IconMenuItem

        public IconMenuItem(string text, Icon icon)
        {
            bitmap = icon.ToBitmap();
            Text = text;

            Init();
        }
开发者ID:xwiz,项目名称:WixEdit,代码行数:7,代码来源:IconMenuItem.cs

示例10: UnrealAboutBox

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="AppIcon">The icon of the host application.</param>
		public UnrealAboutBox(Icon AppIcon, EngineVersioning Versioning)
		{
			InitializeComponent();

			Assembly EntryAssembly = Assembly.GetEntryAssembly();
			
			mLabel_AppVersion.Text = mLabel_AppVersion.Text.Replace("N/A", EntryAssembly.GetName().Version.ToString());

			if( Versioning == null )
			{
				Versioning = new EngineVersioning();
			}

			if( Versioning.Changelist > -1 )
			{
				mLabel_Changelist.Text = mLabel_Changelist.Text.Replace( "N/A", Versioning.Changelist.ToString() );
			}

			if( Versioning.EngineVersion > -1 )
			{
				mLabel_EngineVersion.Text = mLabel_EngineVersion.Text.Replace( "N/A", Versioning.EngineVersion.ToString() );
			}

			mPictureBox_AppIcon.Image = AppIcon.ToBitmap();
		}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:29,代码来源:UnrealAboutBox.cs

示例11: Icon_Load

        private void Icon_Load(object sender, EventArgs e)
        {
            try
            {
                if (innerContent == null) return;

                Icon ic = null;

                byte[] imageBytes = Convert.FromBase64String(innerContent);
                using (MemoryStream ms = new MemoryStream(imageBytes))
                {
                    ic = new Icon(ms);
                }

                pictureBox1.Image = ic.ToBitmap();

                pictureBox1.Height = pictureBox1.Image.Size.Height;
                pictureBox1.Width = pictureBox1.Image.Size.Width;

                if (pictureBox1.Width > panel1.Width)
                    pictureBox1.Width = panel1.Width;

                pictureBox1.Location = new Point(
                    Width / 2 - pictureBox1.Width / 2,
                    Height / 2 - pictureBox1.Height / 2);
            }
            catch (Exception error)
            {
                MessageBox.Show("An error occured while loading this web resource: " + error.Message, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:32,代码来源:IconControl.cs

示例12: SetIconImage

 private void SetIconImage()
 {
     using (var stream = new MemoryStream(Configuration.MainIcon))
     using (var icon = new Icon(stream, new Size(32, 32)))
     {
         _icon.Image = icon.ToBitmap();
     }
 }
开发者ID:netide,项目名称:netide,代码行数:8,代码来源:BasicInformationStep.cs

示例13: GetImage

        public static Image GetImage( string iconfilename , Data.DataType datatype , string softwaredir )
        {
            String fullpathsoftware = MultiplePathCombine( new String [ ] { Settings.startpath , Settings.iconspath , iconfilename } );
            String fullpathicons = MultiplePathCombine( new String [ ] { Settings.startpath , Settings.setupspath , softwaredir , iconfilename } );
            if ( iconfilename.Length > 4 )
            {
                if ( iconfilename.Contains( "." ) )
                {

                    try
                    {
                        if ( File.Exists( iconfilename ) )
                        {
                            if ( Path.GetExtension( iconfilename ).ToLower( ) == ".ico" )
                            {
                                Icon a1 = new Icon( iconfilename );
                                return ( Image ) a1.ToBitmap( );
                            }
                            else
                            {
                                return new Bitmap( new Bitmap( iconfilename ) , new Size( 32 , 32 ) );
                            }
                        }
                        else if ( File.Exists( fullpathsoftware ) )
                        {
                            if ( Path.GetExtension( fullpathsoftware ).ToLower( ) == ".ico" )
                            {
                                Icon a1 = new Icon( fullpathsoftware );
                                return ( Image ) a1.ToBitmap( );
                            }
                            else
                            {
                                return new Bitmap( new Bitmap( fullpathsoftware ) , new Size( 32 , 32 ) );
                            }
                        }
                        else if ( File.Exists( fullpathicons ) )
                        {
                            if ( Path.GetExtension( fullpathicons ).ToLower( ).TrimEnd( ' ' ) == ".ico" )
                            {
                                Icon a1 = new Icon( fullpathicons );
                                return ( Image ) a1.ToBitmap( );
                            }
                            else
                            {
                                return new Bitmap( new Bitmap( fullpathicons ) , new Size( 32 , 32 ) );
                            }
                        }

                    }
                    catch ( Exception ex )
                    {

                        Debug.WriteLine( ex.ToString( ) );
                    }
                }
            }
            return null;
        }
开发者ID:roboter,项目名称:FlashAutorun,代码行数:58,代码来源:Utils.cs

示例14: AppentMenuStripItem

 public virtual void AppentMenuStripItem(string text, Icon icon, EventHandler clickHandler, IDynamicStateProvider dynamicStateProvider = null)
 {
     if (text.IsNullOrEmpty() || icon == null || clickHandler == null)
       {
     return;
       }
       EventHandler asyncClickHandler = (sender, args) => Task.Factory.StartNew(() => clickHandler(sender, args));
       var menuItem = new ExtendedToolStripMenuItem(text, icon.ToBitmap(), asyncClickHandler) { DymamicStateProvider = dynamicStateProvider };
       this.OutputItems.Add(menuItem);
 }
开发者ID:Zvirja,项目名称:TrayGarden,代码行数:10,代码来源:MenuEntriesAppender.cs

示例15: GetIcon_InternalWithOverlay

        private static Icon GetIcon_InternalWithOverlay(Icon baseIcon, Icon overlayIcon)
        {
            // overlay custom icon with overlay icon
              Bitmap iconBitmap = baseIcon.ToBitmap();
              Graphics graphics = Graphics.FromImage(iconBitmap);
              graphics.DrawIcon(overlayIcon, new Rectangle(0, 0, iconBitmap.Width, iconBitmap.Height));
              graphics.Save();

              return Icon.FromHandle(iconBitmap.GetHicon());
        }
开发者ID:wcm-io-devops,项目名称:aem-manager,代码行数:10,代码来源:IconCache.cs


注:本文中的System.Drawing.Icon.ToBitmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。