Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
QuestionAccounting software Pin
cupidanish14-Aug-16 17:25
cupidanish14-Aug-16 17:25 
AnswerRe: Accounting software Pin
Mycroft Holmes14-Aug-16 17:38
professionalMycroft Holmes14-Aug-16 17:38 
AnswerRe: Accounting software Pin
Richard MacCutchan14-Aug-16 21:17
mveRichard MacCutchan14-Aug-16 21:17 
AnswerRe: Accounting software Pin
Emmanuel Medina15-Aug-16 9:07
professionalEmmanuel Medina15-Aug-16 9:07 
QuestionFile comparison (byte, hash and meta) in C# Pin
Frank R. Haugen11-Aug-16 11:54
professionalFrank R. Haugen11-Aug-16 11:54 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Pete O'Hanlon11-Aug-16 22:05
mvePete O'Hanlon11-Aug-16 22:05 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Nathan Minier12-Aug-16 1:31
professionalNathan Minier12-Aug-16 1:31 
QuestionWindows Control Library Project in WinForms ... rant Pin
BillWoodruff11-Aug-16 1:13
professionalBillWoodruff11-Aug-16 1:13 
What is described here applies to both VS 2013 and VS 2015

Consider the case when one wants to make a sub-classed Control (using one of the standard MS provided WinForm Controls) as a separate Project: so that you can end-up with a nice .dll that you can then mount on Visual Studio's ToolBox for handy re-use.

The only relevant new Project Type available is Windows Forms Control Library which when selected gives you an initial Class definition like this:
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestWinFormControlLibrary
{
    public partial class UserControl1: UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
}
And you, foolish mortal, think you could easily rename the Project and change the Class code to something like this:
C#
public partial class CustomTextBoxForWhatever: TextBox
while still leaving the Project Output Type as it is (Class Library).

That won't compile because the call to 'AutoScaleMode in the Designer.cs file will fail because you have stumbled across the assumption VS makes that you are building a ContainerControl, while a sub-classed TextBox does not expose that Type.

Okay, so you take out the call to 'AutoScaleMode, and now your design view switches to no-view ... just the type of screen that you see when you a new Component to a WinForm project. But, you do have, indeed, a sub-classed Control to work with, compile, and then mount in the ToolBox as you wish.

Now, maybe (?) the designers of VS did not assume someone would want to start designing a custom Control by first defining the Control, and then adding another Project to the Solution of Type Windows Form in order to test the Control as it is developed.

If you start a Project of Type WinForms, you can then add a "Custom Control" to it, but then that Control will be embedded in a WinForms Project.

Do you see what I am getting at ? Have I missed something obvious ... again ?

Since you can stick a Control of whatever Type in the ContainerControl Prototype that a Project of Type WinForms Control Library builds-out for you ... is this a non-issue for most mortals ?

Why do I quibble as the executioner asks if I will have the blindfold: usually, if I am going to do this ... and I do ... do this ... I am going to override methods of the sub-classed Control for various reasons.

Could CodeProject not groan under the weight of one more article or tip-trick describing all ... this ?

morituri te salutamus, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008


modified 11-Aug-16 7:33am.

AnswerRe: Windows Control Library Project in WinForms ... rant Pin
Gerry Schmitz11-Aug-16 8:24
mveGerry Schmitz11-Aug-16 8:24 
Questionevent for partial view unload Pin
Raghavendra.Kodimala10-Aug-16 21:12
professionalRaghavendra.Kodimala10-Aug-16 21:12 
AnswerRe: event for partial view unload Pin
Pete O'Hanlon10-Aug-16 21:54
mvePete O'Hanlon10-Aug-16 21:54 
QuestionHaar-feature Object Detection in C# Pin
bird1235810-Aug-16 8:04
bird1235810-Aug-16 8:04 
AnswerRe: Haar-feature Object Detection in C# Pin
Richard Deeming10-Aug-16 8:06
mveRichard Deeming10-Aug-16 8:06 
AnswerRe: Haar-feature Object Detection in C# Pin
Afzaal Ahmad Zeeshan10-Aug-16 8:43
professionalAfzaal Ahmad Zeeshan10-Aug-16 8:43 
QuestionDll strange behavior C # Pin
equelna10-Aug-16 0:42
equelna10-Aug-16 0:42 
AnswerRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 1:59
mveRichard MacCutchan10-Aug-16 1:59 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 4:43
equelna10-Aug-16 4:43 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 4:50
mveRichard MacCutchan10-Aug-16 4:50 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:01
equelna10-Aug-16 5:01 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:03
mveRichard MacCutchan10-Aug-16 5:03 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:11
equelna10-Aug-16 5:11 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:13
mveRichard MacCutchan10-Aug-16 5:13 
GeneralRe: Dll strange behavior C # [SOLVED] Pin
equelna10-Aug-16 6:33
equelna10-Aug-16 6:33 
QuestionImplementing a Cue Banner to a textbox in windows xp with custom color Pin
srikrishnathanthri9-Aug-16 21:41
srikrishnathanthri9-Aug-16 21:41 
AnswerRe: Implementing a Cue Banner to a textbox in windows xp with custom color Pin
Richard MacCutchan9-Aug-16 22:11
mveRichard MacCutchan9-Aug-16 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.