Click here to Skip to main content
15,915,164 members
Home / Discussions / C#
   

C#

 
QuestionSystem.Data.NoNullAllowedException Pin
rich_wenger5-Sep-05 5:19
rich_wenger5-Sep-05 5:19 
QuestionRichtextBox Problem Pin
snouto5-Sep-05 5:07
snouto5-Sep-05 5:07 
AnswerRe: RichtextBox Problem Pin
philip_cole5-Sep-05 6:20
philip_cole5-Sep-05 6:20 
QuestionType casting issue Pin
arusmemon5-Sep-05 4:51
arusmemon5-Sep-05 4:51 
AnswerRe: Type casting issue Pin
Luis Alonso Ramos5-Sep-05 14:35
Luis Alonso Ramos5-Sep-05 14:35 
QuestionDate Time Picker MinMaxDate Pin
Greeky5-Sep-05 4:34
Greeky5-Sep-05 4:34 
AnswerRe: Date Time Picker MinMaxDate Pin
Luis Alonso Ramos5-Sep-05 7:22
Luis Alonso Ramos5-Sep-05 7:22 
QuestionThe weird control problem Pin
doph5-Sep-05 4:34
doph5-Sep-05 4:34 
Hi guys,

I tried many things while searching in the net for the answer but nothing seems to be helping. So maybe someone will have an idea for my problem.

I have faced this weirdest problem with C#.NET 2.0 (Windows Forms).

I have a class that creates an instance of a (Control) Slider() and passes an instance of CheckedListBox() to it. I set the size of CheckedListBox() to (160,100).

The Slider() it its constructor adds the CheckedListBox() that was passed to it to its Contols collection (this.Controls.Add(PassedControl);)

Then I add the Slider() to the form as well.

It looks something like this:

class a
{
using ...;
pulic a()
{
CheckedListBox box = new CheckedListBox();
box.Size = new Size(160,100);
myPanel x = new myPanel(box);
Contols.Add(x);
}
}

Where the myPanel looks something like this:


Class myPanel : System.Windows.Forms.Panel{
protected Control inner;
public myPanel(Contol _ctrl){
inner = _ctrl;
this.Controls.Add(inner);
}
}

My problem is that once the CheckedListBox() is added to the panel, it will change its size a bit. I guess .NET does this to actually make its size be x*Item.Height; so that it looks good or something.

Now, somewhere in the constructor for the myPanel I am trying to get the actual size of the CheckedListBox() and here the weird part starts.

It will always return 100. But the real size of it is 85.

The way I figured this out is this - add "int x = inner.size.height;" and then put a break right after this line.

You will see the both the x and inner.size.height are 100;

now - add the inner to quick watch and it will somehow recalculate the size and the inner.size.height will become 85 but x will remain 100.

Am I missing something or gone mad or what? But when I run this it will not return its real size unless I do the trick with quick watch for "inner". Both the inner.ClientSize and inner.Bounds return same 100 unless "quick watched".

Any ideas, this really is killing me now.

Thanks to all.
QuestionDLL in C++ with pointers. How to use it in C#? Pin
patgo5-Sep-05 4:18
patgo5-Sep-05 4:18 
AnswerRe: DLL in C++ with pointers. How to use it in C#? Pin
RobVai6-Sep-05 16:37
RobVai6-Sep-05 16:37 
QuestionDelay during first use of Exception Pin
harwanegg5-Sep-05 3:28
harwanegg5-Sep-05 3:28 
AnswerRe: Delay during first use of Exception Pin
Andy Brummer5-Sep-05 4:12
sitebuilderAndy Brummer5-Sep-05 4:12 
AnswerRe: Delay during first use of Exception Pin
Daniel Turini5-Sep-05 6:38
Daniel Turini5-Sep-05 6:38 
GeneralRe: Delay during first use of Exception Pin
harwanegg5-Sep-05 20:21
harwanegg5-Sep-05 20:21 
QuestionT-SQL Clause Pin
Greeky5-Sep-05 3:18
Greeky5-Sep-05 3:18 
AnswerRe: T-SQL Clause Pin
Andy Brummer5-Sep-05 4:20
sitebuilderAndy Brummer5-Sep-05 4:20 
QuestionNumber Formatting Pin
Brendan Vogt5-Sep-05 1:56
Brendan Vogt5-Sep-05 1:56 
AnswerRe: Number Formatting Pin
Guffa5-Sep-05 2:37
Guffa5-Sep-05 2:37 
QuestionOverlapping Images Pin
dhanunjay5-Sep-05 1:49
dhanunjay5-Sep-05 1:49 
QuestionImage Resizing in a Picture box using c# Pin
dhanunjay5-Sep-05 1:41
dhanunjay5-Sep-05 1:41 
AnswerRe: Image Resizing in a Picture box using c# Pin
Martin#5-Sep-05 8:41
Martin#5-Sep-05 8:41 
QuestionTIFF file with included color schema Pin
yarns5-Sep-05 0:52
yarns5-Sep-05 0:52 
QuestionImporting a DLL at runtime Pin
totig4-Sep-05 23:09
totig4-Sep-05 23:09 
AnswerRe: Importing a DLL at runtime Pin
totig4-Sep-05 23:52
totig4-Sep-05 23:52 
GeneralRe: Importing a DLL at runtime Pin
mav.northwind5-Sep-05 2:17
mav.northwind5-Sep-05 2:17 

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.