Results 1 to 6 of 6

Thread: [3.0/LINQ] Is control selected at design time

  1. #1

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    [3.0/LINQ] Is control selected at design time

    Hi all,

    Is it possible to determine whether a control is selected at design-time, if so, how?

    Cheers.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  2. #2
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [3.0/LINQ] Is control selected at design time

    how do you mean? Can you explain further?

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [3.0/LINQ] Is control selected at design time

    I think I understand what you mean but for what purpose exactly?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: [3.0/LINQ] Is control selected at design time

    I have a user created control that has no border, but does have a backcolor.

    If its parent container control's backcolor is the same then it is effectively invisible.
    To get around this if the control is being rendered as design-time and the backcolors are the same then it draws a dotted border.

    When the control is selected at design time the designer draws its own dotted border, so my manually drawn one isn't needed.

    P.S. The reason having an effectively invisible control on a form is that at run-time the form doesn't exist and is used purely to lay out a GUI for custom rendering using Microsoft XNA.
    Last edited by SLH; Nov 9th, 2008 at 11:54 AM.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [3.0/LINQ] Is control selected at design time

    I'm not sure whether this will be useful or not but your control inherits the protected DesignMode property from the Component class. In theory you could just wrap the code that draws your border in an 'if' block:
    CSharp Code:
    1. if (!this.DesignMode)
    2. {
    3.     // Draw border.
    4. }
    That said, I've got a feeling that DesignMode will only be 'true' if the control itself is being designed, as opposed to residing on a form that's being designed. Give it a try and see what happens.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: [3.0/LINQ] Is control selected at design time

    Thanks for the reply jmcilhinney, but that's not quite what i'm after.
    I know i can draw the control differently depending on whether we're in design mode or not.
    What i want to do is draw it different if we are in design mode AND this control is the control that's selected in the designer. It's the second bit i'm having trouble with.

    If it can't be done then it can't be done, i just thought it might be a nice touch.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width