小编Dan*_*Lip的帖子

我正在使用PdfSharp并且找不到类BeginBox在哪里?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Drawing;
using PdfSharp;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;

namespace Lightnings_Extractor
{
    class PDF
    {
        public PDF()
        {
            // Create a new PDF document
            PdfDocument document = new PdfDocument();
            document.Info.Title = "Created with PDFsharp";

            // Create an empty page
            PdfPage page = document.AddPage(); 
            // Get an XGraphics object for drawing
            XGraphics gfx = XGraphics.FromPdfPage(page); 
            // Create a font
            XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic); 
            // Draw …
Run Code Online (Sandbox Code Playgroud)

c# pdfsharp

14
推荐指数
1
解决办法
4475
查看次数

如何旋转任何程度的图像?

我有动画gif和我使用类来解析它的图像(帧).这堂课是:

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections.Generic;
using System.IO;

public class AnimatedGif
{
    private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>();
    public AnimatedGif(string path)
    {
        Image img = Image.FromFile(path);
        int frames = img.GetFrameCount(FrameDimension.Time);
        if (frames <= 1) throw new ArgumentException("Image not animated");
        byte[] times = img.GetPropertyItem(0x5100).Value;
        int frame = 0;
        for (; ; )
        {
            int dur = BitConverter.ToInt32(times, 4 * frame);
            mImages.Add(new AnimatedGifFrame(new Bitmap(img), dur));
            if (++frame >= frames) break;
            img.SelectActiveFrame(FrameDimension.Time, frame);
        }
        img.Dispose();
    }
    public List<AnimatedGifFrame> Images { …
Run Code Online (Sandbox Code Playgroud)

c#

10
推荐指数
4
解决办法
3万
查看次数

我如何使用Form.ShowDialog?

private void button2_Click(object sender, EventArgs e)
        {
            ChangeLink cl = new ChangeLink();
            // Show testDialog as a modal dialog and determine if DialogResult = OK.
            if (cl.ShowDialog() == DialogResult.OK)
            {
                // Read the contents of testDialog's TextBox. 
               // cl.AcceptButton.DialogResult = DialogResult.OK;
                this.label4.Text = cl.textBox1Text;
            }
            else
            {
                this.label4.Text = "Cancelled";
            }
            cl.Dispose();

        }
Run Code Online (Sandbox Code Playgroud)

当我单击按钮时,我在新窗体中看到新窗体和textBox1,我可以输入textBox1,但我没有看到任何正常或取消按钮.我应该在新的表单设计器中手动添加它们吗?然后如何使用它们?

这是我的新表单中的代码,我想要做的是在新的表单textBox1中键入内容并将textBox1中的文本传递给Form1 label4.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GatherLinks
{
    public partial class ChangeLink : …
Run Code Online (Sandbox Code Playgroud)

c#

10
推荐指数
2
解决办法
7万
查看次数

自 Unity 5 起,如何处理具有非运动学 Rigidbody 的非凸 MeshCollider 不再受支持?

我使用的是Unity 2019.4.2f1个人版

我遇到异常:

自 Unity 5 起,不再支持具有非运动学刚体的非凸网格碰撞器。如果要使用非凸网格,请使刚体运动学或删除刚体组件。场景层次路径

我有一个父 GameObject ,其中包含一些组件,包括 Rigidbody :

刚体

然后有这个父级的一些子级,在里面的某个地方有这个子级名称 NAVI,并且 NAVI 的所有 polySurface34 子级都有一个带有凸面未选中选项的网格碰撞器。

多面34

我知道,如果我取消选中并禁用所有 polySurface34 对象上的网格碰撞器,它将使错误异常消失,但我不确定这是否是正确的解决方案。

unity-game-engine

8
推荐指数
1
解决办法
2万
查看次数

如何在WriteLine上的c#控制台应用程序中我可以这样做它将替换for循环中同一个应用程序的每一行?

可能重复:
如何更新C#Windows控制台应用程序中的当前行?

我的意思是我在for循环中有一个for.

For (x=0; x<this.Length;x++)
     { 
     for (y=0; y<this.Length;y++)
          {
           Console.WriteLine("Working on file " + images[x] + " please wait");
          }
     }
Run Code Online (Sandbox Code Playgroud)

Console.WriteLine行("Working on file"+ images [x] +"please wait"); 将在控制台窗口中写入每个图像[x]文件行下.我希望它会写一次,然后覆盖相同的行,依此类推.不排队.像计算"工作文件0001,请等待"然后下一行将替换相同的"工作文件0002,请等待"

我试着把Console.Clear(); 在Console.WriteLine之后,然后像闪烁的doestn工作顺利.

c#

7
推荐指数
1
解决办法
9287
查看次数

我得到错误无法读取超出流的结尾为什么?

testing.res文件大小为240MB.我想读它.但我在这一行得到错误:

int v = br.ReadInt32();
Run Code Online (Sandbox Code Playgroud)

EndOfStreamException无法读取超出流的末尾

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            R();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        public void R()
        {
            using (var br = new System.IO.BinaryReader(File.Open(@"d:\testing.res", FileMode.Open)))
            {
                // 2.
                // Position and length variables.
                int pos = 0;
                // 2A.
                // Use BaseStream.
                int length = (int)br.BaseStream.Length; …
Run Code Online (Sandbox Code Playgroud)

c#

6
推荐指数
1
解决办法
4万
查看次数

如何读取GPU负载?

我正在编写一个程序来监视计算机的各种资源,例如CPU使用情况等.我想监控GPU使用率(GPU负载,而不是温度).

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using DannyGeneral;


namespace CpuUsage
{
    public partial class Form1 : Form
    {
        private bool processEnded;
        private Process[] processList;
        private string timeStarted;
        private string timeEnded;
        private List<float> processValues;
        private bool alreadyRun;
        private DateTime dt;
        private DateTime dt1;
        private PerformanceCounter theCPUCounter;
        private PerformanceCounter theMemCounter;
        private PerformanceCounter specProcessCPUCounter;
        private float cpuUsage;
        private float memUsage;
        private List<float> Values;

        public Form1()
        {
            InitializeComponent();

            processEnded = false; …
Run Code Online (Sandbox Code Playgroud)

c# performance gpu video-card

5
推荐指数
1
解决办法
6037
查看次数

如何暂停和恢复BackgroundWorker?

这是我在我的代码中做到的方式:在后面的WorkWorker DoWork活动中我做了:

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            _busy.WaitOne();
                this.Invoke(new MethodInvoker(delegate { label2.Text = "Website To Crawl: "; }));
                this.Invoke(new MethodInvoker(delegate { label4.Text = mainUrl; }));
                webCrawler(mainUrl, levelsToCrawl, e);


        }
Run Code Online (Sandbox Code Playgroud)

然后在暂停按钮单击事件我做了:

private void button4_Click(object sender, EventArgs e)
        {
            _busy.Reset();
        }
Run Code Online (Sandbox Code Playgroud)

在简历按钮单击事件我做了:

private void button5_Click(object sender, EventArgs e)
        {
            _busy.Set();
        }
Run Code Online (Sandbox Code Playgroud)

但是当我点击开始这个过程时,它不起作用:

private void button1_Click(object sender, EventArgs e)
        {
            backgroundWorker1.RunWorkerAsync();
            button1.Enabled = false;
            this.Text = "Processing...";
            label6.Text = "Processing...";
            label6.Visible = true;
            button2.Enabled = false;
            checkBox1.Enabled = false;
            checkBox2.Enabled = …
Run Code Online (Sandbox Code Playgroud)

c#

5
推荐指数
1
解决办法
2万
查看次数

如何从 Assets 文件夹中获取所有预制件?在编辑器中获取无效的强制转换异常

GameObject[] prefabs = (GameObject[])Resources.LoadAll("Assets/Animations/Test");
Run Code Online (Sandbox Code Playgroud)

主要目标是获取所有预制件,并递归以防Test.

c# unity-game-engine

5
推荐指数
3
解决办法
2万
查看次数

预制件(原始)和变体预制件有什么区别?

我有一个用一些颜色着色器等创建的门。前段时间我拖着门,它问我该怎么办时,我选择了变体。但现在我决定选择创建原始预制件和门颜色,或者着色器变成粉红色。

这是资源中原始预制件和变体的屏幕截图。粉红色的是原版,红色的是原版,应该是红色的是变体。

预制件(原始)和变体预制件有什么区别,为什么在制作原始件时将颜色更改为粉红色?

我应该选择什么?原版还是变体?

预制件

以及将门拖到 Assets 之前在场景视图窗口中的屏幕截图:

门

unity-game-engine

5
推荐指数
2
解决办法
4106
查看次数

标签 统计

c# ×8

unity-game-engine ×3

gpu ×1

pdfsharp ×1

performance ×1

video-card ×1