Tag: image

在国际象棋游戏中将图像插入代码c#

2天前我问了一个关于国际象棋比赛的问题,一位朋友建议我下面的代码,我对它有疑问。 这是这个链接 请参阅:私有图像Displayimage; 我不知道如何将棋子中的棋子放入其中,我应该把它放在哪里? class PiecePosition { public enum ChessColor { White, Black, } public class ChessPiece { private Image DisplayedImage; private ChessColor DisplayedColor; private Point CurrentSquare; private Point[] ValidMoves; public ChessPiece(Image image, ChessColor color) { DisplayedImage = image; DisplayedColor = color; } } public class KingPiece : ChessPiece { public KingPiece(Image image, ChessColor color) […]

C#将图像对象读入Web请求

嘿,我目前正在尝试使用Web请求,内存流和图像对象将图像文件发送到Web服务器。 这是我当前发送请求的方法: public void Send(Image image) { //Assign the request here too, just in case Request = (HttpWebRequest)WebRequest.Create(FormURL); Request.Method = “POST”; Request.ContentType = “multipart/form-data; boundary=” + CONTENT_BOUNDARY; Request.Headers.Add(“Cache-Control”, “no-cache”); Request.KeepAlive = true; Request.ContentLength = GetFormElements().Length + GetFileHeader(FileName).Length + FILE_TRAIL.Length + ConvertImageToByteArray(image).Length; //Must be done in this order for stream to write properly: //—- //Form elements […]

将数据库中的图像检索到图像标记中

我的Web应用程序允许用户发送报告,并且最多可以将5个图像作为varbinary(MAX)插入数据库(SQL Server)。 我现在正在找到一种方法来检索用户发送的特定报告的所有图像。 以前,我曾经通过aspx页面逐个检索图像1。 但是当用户只插入5个图像时,我遇到了一个问题。我的另外4个图像标签将显示空图像。 所以现在我试图找到一种方法,如果我可以在1个图像标签中基于报告检索这些图像。 图像与之前的报告存储在同一个表中,现在我将其更改为2个表。 MemberReport是报告的所有详细信息,MemberReportImage是报告的所有图像。 下面的代码允许我根据memberreportid将我的MemberReportImage表中的第一个图像检索到图像标记中,但是我想一次检索具有相同memberreportid的所有图像而不是图像标记。 正如我认为它需要一个循环来获取所有图像,但我不知道该怎么做。 所以我需要有人来帮助我。 谢谢! protected void Page_Load(object sender, EventArgs e) { string strQuery = “select image from MemberReportImage where memberreportid='” + Session[“memberreportid”] + “‘”; SqlCommand cmd = new SqlCommand(strQuery); DataTable dt = GetData(cmd); if (dt != null) { download(dt); } } private DataTable GetData(SqlCommand cmd) { DataTable […]

如何改变图像的大小

我从CameraCaptureTask获取图像,我希望能够在保存之前使图像更小。 宽度和高度自动设置为最高分辨率,远远超过我的需要。 虽然我遇到了错误,但我一直试图获取图像,更改尺寸,然后尝试保存。 原版的 MainPage.xaml.cs中 private void cameraTask_Completed(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { BitmapImage bmi = new BitmapImage(); bmi.SetSource(e.ChosenPhoto); //MessageBox.Show(bmi.PixelWidth.ToString() + “x” + bmi.PixelHeight.ToString()); var gcd = GCD(bmi.PixelWidth, bmi.PixelHeight); var result = string.Format(“{0}:{1}”, bmi.PixelWidth / gcd, bmi.PixelHeight / gcd); WriteableBitmap wb; Stream stream; switch (result) { case “3:4”: wb = new […]

WPF控件图像在WinForms中失败

我是WPF的菜鸟。 我有一个标签控件,标签上有一个图标。 当我通过ElementHost导入winforms中的控件时,图标不会出现在选项卡上。 我从Resource加载图标图像。 XAML代码: 如果有人可以帮助我。 对不起打字错误。 最好的祝福。

通过C#对XMPGPano元数据进行图像处理:用于facebook 360图像

我使用C#-emgu通过自定义拼接制作facebook 360图像。 能够使用C#图像属性项设置EXIF标记(制作和模型)。 // Sample code for set exif make tag var dummy1 = Image.FromFile(@”filePathName.jpg”); PropertyItem pItem = dummy1.PropertyItems[0]; string str = System.Text.Encoding.UTF8.GetString(pItem.Value); pItem.Id = 0x010F; // make tag id pItem.Type = 2; pItem.Value = System.Text.Encoding.UTF8.GetBytes(“*****”); pItem.Len = pItem.Value.Length; jpeg1.SetPropertyItem(pItem); 无法设置C#列出的XMPGPano标签。 XMPGPano文档在谷歌街景 * CroppedAreaImageHeightPixels (final image height) * CroppedAreaImageWidthPixels (final image width) * ProjectionType (equirectangular) […]

从DB检索图像时参数无效

最后,我想从Access数据库中获取一个OLE类型的图像并将其放入一个图片框中。 在C#和MS Access 2010中使用Visual Studio 2012.我的解决方案是一个非Web相关的应用程序。 所以这是查询代码。 我正在构建一个对象( Equipamento ),其中包含一个System.Drawing.Image属性,这是该问题的焦点。 OleDbConnection l = OleDbConnectionDAO.createConnection(); Equipamento eq = new Equipamento(); try { OleDbDataAdapter adapter = new OleDbDataAdapter( “SELECT * FROM [APP_Equipamento_Geral] WHERE COD_ETIQ like ‘%” + codigo + ” %'”, l); DataSet ds = new DataSet(); adapter.Fill(ds, “[APP_Equipamento_Geral]”); string s = ds.Tables[“[APP_Equipamento_Geral]”].Columns[16].ColumnName; foreach (DataRow row in […]

在iTextSharp中缩放图像

我在缩放我插入的图像时遇到了一些麻烦。 我必须做错事,因为无论我做什么,它都不会改变。 这是我目前的代码,但它似乎不起作用。 图像插入正常,无论我尝试什么值,它都不会缩放。 我做错了什么明显的事情? 人们做错了什么常见的事情? 我在C#工作,但我认为所有语言的语法都相同(或多或少)。 Image imgSpine = Image.GetInstance(strSpine); imgSpine.ScaleAbsolute(2, 55); SpineCell.Image = imgSpine; SpineCell.Image.Border = Rectangle.NO_BORDER; SpineCell.VerticalAlignment = Element.ALIGN_TOP; SpineCell.HorizontalAlignment = Element.ALIGN_LEFT; pTable.AddCell(SpineCell);

WordPress XML RPC上传图片C#

嘿所有,我正在开发一个工作站点,将使用Wordpress XML RPC将信息从数据库推送到Wordpress。 我可以抓取信息并发布它就好了,但是当我到达上传图像时它似乎工作(WP媒体选项卡中没有运行时错误/图像)但是它上传了一个损坏的图像链接。 它似乎不知道从我的图像获取数据,我不知道为什么这里有我的一些代码。 MemoryStream ms = new MemoryStream(); System.Drawing.Image img = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(“_Images/DownloadButton-PSD.png”)); img.Save(ms, ImageFormat.Png); byte[] imagebytes = new byte[ms.Length]; ms.Position = 0; ms.Read(imagebytes, 0, Convert.ToInt32(ms.Length)); 在该代码加载图像信息之后,我将其以Data变量的格式传递给函数 var data = new Data { Base64 = Convert.ToBase64String(imagebytes), Name = “DownloadButton-PSD.png”, Type = “image/png”, Overwrite = false, }; _wpWrapper.UploadFile(data); 仅供参考:我也在使用http://joeblogs.codeplex.com/上的dll作为我的项目 数据类如下所示: public class Data { public […]

如何从RichEditBox获取图像

我有一个RichEditBox,我已经通过代码插入了一个图像。 现在,我想在一些过程之后获取插入的图像。 有没有办法从RichEditBox获取图像? 任何帮助将不胜感激!!