我需要旋转一个WriteableBitmap并在它被裁剪之前向下或向上缩放.
我的当前代码将旋转,但如果高度大于宽度,则会裁剪边缘.
我想我需要扩展?
public WriteableBitmap Rotate(WriteableBitmap Source, double Angle)
{
RotateTransform rt = new RotateTransform();
rt.Angle = Angle;
TransformGroup transform = new TransformGroup();
transform.Children.Add(rt);
Image tempImage2 = new Image();
WriteableBitmap wb;
rt.CenterX = Source.PixelWidth / 2;
rt.CenterY = Source.PixelHeight / 2;
tempImage2.Width = Source.PixelWidth;
tempImage2.Height = Source.PixelHeight;
wb = new WriteableBitmap((int)(Source.PixelWidth), Source.PixelHeight);
tempImage2.Source = Source;
tempImage2.UpdateLayout();
wb.Render(tempImage2, transform);
wb.Invalidate();
return wb;
}
Run Code Online (Sandbox Code Playgroud)
如何缩小图像以使其不会被裁剪?或者还有另一种方式吗?
我该如何在C#中的后面代码中编写此代码?gcAllowVeryLargeObjects我不能使用配置文件。
下面是配置文件的版本
<configuration>
<runtime>
<gcAllowVeryLargeObjects enabled="true" />
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我是 RabbitMQ 的新手,并尝试写入队列并验证消息是否已发送。如果它失败了,我需要知道它。我制作了一个假队列来观看它失败,但无论我看到什么都没有执行,当我在寻找 ack 时,我总是得到一个。我从没见过 BasicNack。
我什至不确定我是 BasicAcks 是要走的路。
private void button1_Click(object sender, EventArgs e)
{
var factory = new ConnectionFactory() { HostName = "localhost" };
using (var connection = factory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
channel.QueueDeclare("task_queue", true, false, false, null);
var message = ("Helllo world");
var body = Encoding.UTF8.GetBytes(message);
channel.ConfirmSelect();
var properties = channel.CreateBasicProperties();
properties.SetPersistent(true);
properties.DeliveryMode = 2;
channel.BasicAcks += channel_BasicAcks;
channel.BasicNacks += channel_BasicNacks;
//fake queue should be task_queue
channel.BasicPublish("", "task_2queue", true, properties, body);
channel.WaitForConfirmsOrDie();
Console.WriteLine(" [x] …
Run Code Online (Sandbox Code Playgroud) 如何判断Windows 8 Metro应用程序何时进入后台?暂停状态不会激活.我有一个突破点.它只会在我关闭应用程序时点击.
我正在使用网络摄像头,因为没有应用程序可以在后台运行,我需要保存我的工作,当它放在后台.
Windows手机是应用程序停用.
你能帮忙的话,我会很高兴.
使用Windows Phone 8我需要能够使用C#在Excel中打开CSV文件.它们是市场上现在称为Excel Extensions的应用程序,它可以在本地转换csv文件.
我已经厌倦了使用开放式办公室XML转换CSV文件,但这不起作用.我想在本地做,所以没有网络服务.
任何人都知道如何在Windows Phone 8平台上将CSV文件转换为Excel?