compact framework - C# - Block code from executing in the designer -


I am executing a line of code that fails to execute within the designer, due to which all of my control Public attributes are not left so far in the designer, due to this I can not see any of my forms which use that control in the Visual Studio Design View.

The line of code in the question says an unsafe code project that does a bit of image processing; Commenting on this, the design scene comes back to life, however, the code is executed completely, so I do not know why the code in the designer is failing. This is the code that is being called:

  /// & lt; Summary & gt; /// Source adjusts colors on bitmap /// & lt; / Summary & gt; /// & lt; Param name = "source" & gt; The bitmap to be processed has been changed by this process. & Lt; / Param & gt; /// & lt; Param name = "redChange" & gt; Change in red value can be negative. & Lt; / Param & gt; /// & lt; Param name = "greenchange" & gt; Change to Green Value. Can be negative & Lt; / Param & gt; /// & lt; Ultimate name = "Blue Change" & gt; Change to the blue price Can be negative & Lt; / Param & gt; /// & lt; Returns & gt; & Lt; / Returns & gt; Public stable bitmap processor (bitmap source, int red change, int green color change, int blue change) {sourceBitmap = source; // Lock the source bitmap source bitmapData = getBitmapData (sourcebitmap, referee source); SourcepBase = (Byte *) SourceBitMapData. Scan 0 Tapointer (); Pixeldata * pixels; For (int y = 0; y & lt; source.Height; y ++) {pPixel = (pixelata *) (sourcepBase + y * sourceWidth); {Int redVal = pPixel-> red + redChange; for int x = 0; x & lt; source.Width; x ++) If (Lalval & lt; 0) redVal = 0; If (redvalue> 255) redwell = 255; PPixel- gt; Red = (byte) redVal; Int greenVal = pPixel-> Green + green color; If (Greenwell & lt; 0) greenVal = 0; If (Greenwell> 255) Greenwell = 255; PPCL- & gt; Green = (byte) greenwell; Int blueVal = pPixel-> Blue + blue change; If (Bluewell & lt; 0) Bluewell = 0; If (BlueWell> 255) Bluewell = 255; PPixel-> Blue = (byte) blueVal; PPixel ++; }} SourceBitmap.UnlockBits (sourceBitmapData); SourceBitmapData = Null; SourcepBase = Faucet; Return source; }  

(courtesy of OpenNETCF community)

My project has not been marked as unsafe, but what is in the above code is marked as unsafe whether both Need to mark projects as unsafe?

Or, can I block the firing of code in the designer (I do not really need to produce this code in the form of a design, it is only generated from a ready image of a disabled version of an image Has been doing).

Edit: Blocking the code from running does not fix the problem. Commenting outside the line only allows the design scene to work. In the line (even if putting in false [false == true] statement) the designer causes the errors to be displayed instead of the form.

code :

  Wrap the part of the code if (! DesignMode) {// your "insecure" code goes here}}  

If you're using Compact Framework, use it:

  If the ( = null & design mode) {// your "insecure" code goes here}  

In the mode, see that an animal DesignMode is actually.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -