English 中文(简体)
如何使非公众人物了解情况箱的价值?
原标题:How to get the value of non- public members of picturebox?
  • 时间:2010-07-22 09:04:27
  •  标签:
  • c#

我需要从影像箱中非公众成员获得图像直径的价值。

如何获得这一价值?

提前感谢。

最佳回答

这是如何利用思考来获得价值:

PropertyInfo pInfo = pictureBox1.GetType().GetProperty("ImageRectangle", 
    System.Reflection.BindingFlags.Public | 
    System.Reflection.BindingFlags.NonPublic | 
    System.Reflection.BindingFlags.Instance);

Rectangle rectangle = (Rectangle)pInfo.GetValue(pictureBox1, null);

尽管正如约恩说过的那样,实现你重新努力的目标可能更好。 通过思考接触私人成员通常是一种极大的法典轮.。

问题回答

页: 1 这样做是为了思考......,但你应该说。 这并不确切地说明你通过“图像重塑”的含义,但你一定要设法通过公众宣传媒介来做到这一点。 你想要达到什么目标? 可能采取不同的方式。

EDIT:Oka,现在,我看到你试图获得的财产......你对2004年提出的Connect 问题感兴趣。 尽管你出于同样的原因是否需要,但我不知道。

虽然Nivas的确说他想要完成的工作,但我怀疑这类似于我刚才所看到的情况,即把一个用户撤出(即作物)混入图像箱中。 正如RvdK所建议的那样,我没有尝试继承,我把思考方法作为快速的工作。 除了RvdK的建议或Microsoft的开端,还可以提供一种Rectangle ToImageRectangle方法。 我可以把哪一个东西包在从PB......继承的物体中。

微软联通 问题联系被打破。

这里使用的是I号法典,它提供了PB图像的直径,并进行了测试。 页: 1 特殊模式:

PropertyInfo pInfo = pictureBox1.GetType().GetProperty("ImageRectangle",
            System.Reflection.BindingFlags.Public |
            System.Reflection.BindingFlags.NonPublic |
            System.Reflection.BindingFlags.Instance);

Rectangle ImRectangle = (Rectangle)pInfo.GetValue(pictureBox1, null);

Point rTL = new Point((rectCropArea.Left - ImRectangle.Left) * pictureBox1.Image.Width / ImRectangle.Width,
                      (rectCropArea.Top - ImRectangle.Top) * pictureBox1.Image.Height / ImRectangle.Height);
Size rSz = new Size(pictureBox1.Image.Width * rectCropArea.Width / ImRectangle.Width,
                    pictureBox1.Image.Height * rectCropArea.Height / ImRectangle.Height);

 rect  = new Rectangle(rTL,rSz);




相关问题
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. ...

热门标签