English 中文(简体)
调查结果百分比
原标题:Finding a percentage
  • 时间:2010-12-01 15:02:49
  •  标签:
  • c#
  • formula

这里是问题。 我的景象是,根据装满的景象,每次都会出现不同的情况。

我愿扩大这一形象,使之适合文件内,该文件有800个顶峰。 因此,如果图像的高度为2560px,我需要找到所需的PERCENTAGE,使该钢材的高度降至750,从而在网页上安装。

I m stuck trying to find the formula for this simple enough problem.

我的守则如下:

iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(
    image, System.Drawing.Imaging.ImageFormat.Jpeg);

if (pic.Height > pic.Width)
{
    //Maximum height is 800 pixels.
    pic.Height formula goes here....
}
else
{
    //Maximum width is 600 pixels.
    pic.Width formula goes here....
}
最佳回答

Some number p is such that p * 2560 = 750. Therefore, p = 750 / 2560 = 0.29296875.

当然,确保你进行浮动点划分。

问题回答

rule of three将帮助你确定。

我不知道我是否确切理解你的问题。 你们是否意味着这样的东西?

页: 1

例:

(750/ 2560) * 100=29

这意味着:2560 * 0.29=750

这里X是最大预期的高度,即实际形象高,p是百分比。

p = x / y;
x = p * y;
y = x / p;

鉴于有两人可以找到另一人。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签