Search Results

Search found 5 results on 1 pages for 'pedery'.

Page 1/1 | 1 

  • PropertyGrid PaintValue problem: How to remove (and paint outside) the standard rectangle?

    - by Pedery
    This might be a straightforward question, even though I haven't found an easy solution to it: I've implemented my custom UITypeEditor with the sole purpose of adding a PaintValue to bools. For the sake of the discussion, let's assume that PaintValue will either paint a checked or unchecked radiobutton. Question 1: Now, here's the problem: It seems like PaintValue automatically inserts a 20x13px rectangle after all paint code has completed. Naturally, a radiobutton inside a black rectangle is ugly. Can I easily instruct or override this rectagle not to be painted? Question 2: In this respect, is it possible to paint on top of the propertygrid's native look - meaning could I paint something in order to obscure (part of) the black line separating two grid cells vertically? The purpose of doing this would be to indicate that two values were linked, like constrained width/height to an aspect ratio.

    Read the article

  • Insert custom TypeConverter on a property at runtime, from inside a custom UITypeEditor

    - by Pedery
    I've created a custom UITypeEditor. Can I possibly insert an attribute that also attaches a TypeConverter to my property from inside the UITypeEditor class? I've tried the following, but nothing happens, no matter how I twist and turn it: Attribute[] newAttributes = new Attribute[1]; newAttributes[0] = new TypeConverterAttribute(typeof(BooleanConverter)); Now, the above needs to have the following attached to it somehow: TypeDescriptor.AddAttributes(context.Instance.PROPERTYNAME, newAttributes); ...but first of all I don't know how to get to the property in question in a generic way, and all code I try just fails. Even if I try to assign the TypeConverter in this manner globally, it fails. (Setting it as an attribute on the property itself works though, just to rule out that the bug is in that part.)

    Read the article

  • C#: Insert custom TypeConverter on a property at runtime, from inside a custom UITypeEditor

    - by Pedery
    I've created a custom UITypeEditor. Can I possibly insert an attribute that also attaches a TypeConverter to my property from inside the UITypeEditor class? I've tried the following, but nothing happens, no matter how I twist and turn it: Attribute[] newAttributes = new Attribute[1]; newAttributes[0] = new TypeConverterAttribute(typeof(BooleanConverter)); Now, the above needs to have the following attached to it somehow: TypeDescriptor.AddAttributes(context.Instance.PROPERTYNAME, newAttributes); ...but first of all I don't know how to get to the property in question in a generic way, and all code I try just fails. Even if I try to assign the TypeConverter in this manner globally, it fails. (Setting it as an attribute on the property itself works though, just to rule out that the bug is in that part.)

    Read the article

  • Winforms: How to speed up Invalidate()?

    - by Pedery
    I'm developing a retained mode drawing application in GDI+. The application can draw simple shapes to a canvas and perform basic editing. The math that does this is optimized to the last byte and is not an issue. I'm drawing on a panel that is using the built-in Controlstyles.DoubleBuffer. Now, my problem arises if I run my app maximized on a big monitor (HD in my case). If I try to draw a line from one corner of the (big) canvas to the diagonally oposite other, it will start to lag and the CPU goes high up. Each graphical object in my app has a boundingbox. Thus, when I invalidate the boundingbox of a line that goes from one corner of the maximized app to the oposite diagonal one, that boundingbox is virtually as big as the canvas. When a user is drawing a line, this invalidation of the boundingbox thus happens on the mousemove event, and there is a clear lag visible. This lag also exists if the line is the only object on the canvas. I've tried to optimize this in many ways. If I draw a shorter line, the CPU and the lag goes down. If I remove the Invalidate() and keep all other code, the app is quick. If I use a Region (that only spans the figure) to invalidate instead of the boundingbox, it is just as slow. If I split the boundingbox into a range of smaller boxes that lie back to back, thus reducing the invalidation area, no visible performance gain can be seen. Thus I'm at a loss here. How can I speed up the invalidation? On a side note, both Paint.Net and Mspaint suffers from the same shortcommings. Word and PowerPoint however, seem to be able to paint a line as described above with no lag and no CPU load at all. Thus it's possible to achieve the desired results, the question is how?

    Read the article

  • C# properties: How are they instantiated?

    - by Pedery
    Hi! This might be a pretty straightforward question, but I'm trying to understand some of the internal workings of the compilation. Very simply put, imagine an arbitrary object being instantiated. This object is then allocated on the heap. The object has a property of type PointF (which is value type), with a get and a set method. Imagine the get and the set method containing a few calculations for doing their work. How and where (stack/heap) and when is this code instantiated? This is the background for this question: I'm writing get and set methods for an object and these methods need to be accessed very frequently. The get and set code in itself is rather massive so I feared that in a worst case scenario the methods would be instantiated as an object or a value type with all internal code for every access of the property. On the other hand the code is probably instantiated when the main object is created and the CPU is simply told to jmp to the property code start. Anyway, this is what I want to have clarified.

    Read the article

1