Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7809433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:26:14+00:00 2026-06-02T03:26:14+00:00

I’m having an issue at design time with all my forms and custom controls

  • 0

I’m having an issue at design time with all my forms and custom controls within Visual Studios 2008. Up until the previous check in, all of the controls were rendering as expected. The only main difference between the current version and the previous working version was that a Property on the control UIText was renamed from Content to Value. The other changes are adding a new form and 3 new enums, but there’s certainly no obvious change that would affect all forms in the program (including new ones).

All of the controls (on every form) now render as a box with the name of the control (however they all render correctly at run time):

Rendering Issue

I’ve tried creating a brand new form in my project, creating a brand new custom control with just a label on it, and I’ve still got exactly the same problem:

Bizarre

Note that standard .Net form controls work fine, so this is only an issue with custom controls.

If I restore my previous version from the repository, then everything starts rendering correctly again:

Rendering Correctly

I could just revert back to this working version and carry on, but I’d rather know how to fix the problem should it occur again. I’m posting here hoping it’s a programming issue as apposed to a Visual Studios 2008 issue (on SP1 by the way).

UPDATE – Issue traced, can’t explain it

I fixed the issue. Well, fixed isn’t really the right word for it. I located the issue by removing all of the user controls 1 at a time until the form started rendering properly again. The issue was in my Signature control (which has been present for ages, only in my latest check in I had added a reference to the project iVirtualDocket.CodeLibrary into the main project:

  iVirtualDocket
    - References iVirtualDocket.UIControls
    - References iVirtualDocket.CodeLibrary
  iVirtualDocket.UIControls
    -References iVirtualDocket.CodeLibrary

The signature has a property called SignatureData, which was doing this:

public byte[] SignatureData
{
    get
    {
        if (_signature == null)
        {
            return null;
        }
        else
        {
            return iVirtualDocket.CodeLibrary.Conversions.ImageToByteArray(
                _signature, ImageFormat.Png);
        }
    }
}

ImageToByteArray looks like the following:

public static byte[] ImageToByteArray(Image imageToConvert,
        ImageFormat formatOfImage)
{
    byte[] ret;
    using (MemoryStream ms = new MemoryStream())
    {
        imageToConvert.Save(ms, formatOfImage);
        ret = ms.ToArray();
    }

    return ret;
}

If I move the above method into the UIControls project, then everything works fine. However, as soon as I put the method back into the CodeLibrary project and call it there, all my forms stop rendering UserControls.

So doing the following fixes the problem, but I’d really like to know why:

public byte[] SignatureData
{
    get
    {
        if (_signature == null)
        {
            return null;
        }
        else
        {
            // Need to call this code directly here instead of through 
            // the CodeLibrary conversions, otherwise all user controls stop 
            // rendering in design mode
            byte[] ret;
            using (MemoryStream ms = new MemoryStream())
            {
                _signature.Save(ms, ImageFormat.Png);
                ret = ms.ToArray();
            }

            return ret;
        }
    }
}

(What’s even more bizarre is that I don’t even use this property yet.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:26:15+00:00Added an answer on June 2, 2026 at 3:26 am

    We have an application that had similar non-design-time display problems. By doing some research (and I don’t remember exactly where we found it), we ended up creating a file

    DesignTimeAttributes.xmta

    Its type is that of “Design-Time Attribute File”

    and in it, we just had to declare each of the control classes we had defined and qualified it as “DesktopCompatible”. This way it apparently tells the designer its ok to draw, and the actual functionality within some controls (also a signature control on a handheld scanner for us), would actually invoke something during runtime that was not available in the designer. The content of the file was something like…

    <?xml version="1.0" encoding="utf-16"?>
    <Classes xmlns="http://schemas.microsoft.com/VisualStudio/2004/03/SmartDevices/XMTA.xsd">
      <Class Name="MyNamespace.MyControl">
        <DesktopCompatible>true</DesktopCompatible>
      </Class>
    
      <Class Name="MyNamespace.MyOtherControl">
        <DesktopCompatible>true</DesktopCompatible>
      </Class>
    
      <Class Name="AnotherNamespace.MySignControl">
        <DesktopCompatible>true</DesktopCompatible>
      </Class>
    </Classes>
    

    This was also in addition to the comments provided csauve’s answer. If your constructor is trying to initialize something that is device dependent and thus throws an error because the design-time doesn’t obviously have the device dlls, controls, or whatever could/would also kill that control at design time. We’ve created two static functions to test either way via

    public static bool IsDesignTime()
    {
      return System.ComponentModel.LicenseManager.UsageMode ==
             System.ComponentModel.LicenseUsageMode.Designtime;
    }
    
    public static bool IsRunTime()
    {
      return System.ComponentModel.LicenseManager.UsageMode ==
             System.ComponentModel.LicenseUsageMode.Runtime;
    }
    

    and call them respectively in the constructors…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.