Click here to Skip to main content
15,913,186 members
Home / Discussions / C#
   

C#

 
AnswerRe: Type casting Pin
Pete O'Hanlon18-Jun-08 8:37
mvePete O'Hanlon18-Jun-08 8:37 
QuestionCustom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
rcaciopp18-Jun-08 5:01
rcaciopp18-Jun-08 5:01 
AnswerRe: Custom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
led mike18-Jun-08 5:26
led mike18-Jun-08 5:26 
GeneralRe: Custom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
rcaciopp18-Jun-08 6:24
rcaciopp18-Jun-08 6:24 
GeneralRe: Custom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
darkelv18-Jun-08 6:31
darkelv18-Jun-08 6:31 
GeneralRe: Custom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
rcaciopp18-Jun-08 6:48
rcaciopp18-Jun-08 6:48 
GeneralRe: Custom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
darkelv18-Jun-08 6:58
darkelv18-Jun-08 6:58 
AnswerRe: Custom Control implementation at Runtime via Code vs. Designtime via Toolbox Pin
rcaciopp18-Jun-08 7:26
rcaciopp18-Jun-08 7:26 
Wow, Dark....the solution!

Interesting that something as innocent to my newbie-self as setting the size of the object would have the effect of firing the OnPaint() method. I had assumed that the Size property would be created when the constructor hit the OnPaint method, but in fact it seems that the compiler will not fire OnPaint up at all without a Size being set.

FYI - this code added to either a method other than Form_Load or to Form_Load works just fine to add my control to the Form:
private void Form1_Load(object sender, EventArgs e)
{
    myPBL = new ProgressBarLabel.ProgressBarLabel();
    myPBL.Location = new System.Drawing.Point(15, 15);
    myPBL.Name = "progressBarLabel2";
    myPBL.ProgressBarBackColor = System.Drawing.SystemColors.Control;
    myPBL.ProgressBarWidthRatio = 0F;
    myPBL.Size = new System.Drawing.Size(137, 23);
    myPBL.TabIndex = 2;
    myPBL.Text = "progressBarLabel1";
    this.Controls.Add(myPBL);
}


If you comment out this line:
myPBL.Size = new System.Drawing.Size(137, 23);


I can reproduce the error. Really nice to know. Thanks for your help, Dark! Cool | :cool:
QuestionCulture independant Dates? Pin
Megidolaon18-Jun-08 3:59
Megidolaon18-Jun-08 3:59 
AnswerRe: Culture independant Dates? Pin
Luc Pattyn18-Jun-08 4:17
sitebuilderLuc Pattyn18-Jun-08 4:17 
AnswerRe: Culture independant Dates? Pin
PIEBALDconsult18-Jun-08 4:45
mvePIEBALDconsult18-Jun-08 4:45 
GeneralRe: Culture independant Dates? Pin
Megidolaon19-Jun-08 21:01
Megidolaon19-Jun-08 21:01 
Questionxcopy in post build event Pin
Russell Jones18-Jun-08 3:29
Russell Jones18-Jun-08 3:29 
QuestionListViewItem image overlay [modified] Pin
ajtunbridge18-Jun-08 2:59
ajtunbridge18-Jun-08 2:59 
AnswerRe: ListViewItem image overlay Pin
led mike18-Jun-08 5:24
led mike18-Jun-08 5:24 
GeneralRe: ListViewItem image overlay Pin
ajtunbridge18-Jun-08 5:48
ajtunbridge18-Jun-08 5:48 
Questionhow to check the database connected is readonly? Pin
nicolus18-Jun-08 2:46
nicolus18-Jun-08 2:46 
AnswerRe: how to check the database connected is readonly? Pin
Bert delaVega18-Jun-08 16:27
Bert delaVega18-Jun-08 16:27 
Questionfloat representation Pin
George_George18-Jun-08 2:24
George_George18-Jun-08 2:24 
AnswerRe: float representation Pin
Alan Balkany18-Jun-08 3:14
Alan Balkany18-Jun-08 3:14 
GeneralRe: float representation Pin
George_George18-Jun-08 3:29
George_George18-Jun-08 3:29 
GeneralRe: float representation Pin
Colin Angus Mackay18-Jun-08 3:34
Colin Angus Mackay18-Jun-08 3:34 
GeneralRe: float representation Pin
George_George18-Jun-08 3:46
George_George18-Jun-08 3:46 
AnswerRe: float representation Pin
CPallini18-Jun-08 3:32
mveCPallini18-Jun-08 3:32 
GeneralRe: float representation Pin
George_George18-Jun-08 3:43
George_George18-Jun-08 3:43 

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.