|
Does it not compile, or is intellisense just failing ? Have you typed in the full namespace to the class, to see what happens ? I take it you mean the int that goes in gets put onto a private variable with get and set properties ?
The WinForm won't 'see' the class instance for any longer than this method call, unless you're passing it's instance into an ArrayList or something.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, a form inherit System.Windows.Forms.Form,I hold up "WM_NCPAINT"、"WM_SIZE" and Draw caption.But if the form has a mainmenu,it't not drawed after the form minimize and display.
How to do?
thanks..
|
|
|
|
|
|
Hi,
I think I am not sure how to set the docking properties in an application may be.
I am using the ShellControl control [^]which was written by Senthil. I have created an application and I am using a splitter in this application and pn the right side of the application is a tab control for displaying one treeview and one listview.(it is still not there in the application though) My Problem is that I am not able to fix the width of the different parts. I want the table control be the 1/3 of the application window and the shellcontrol window be 2/3 of the width. How I do it? Because when I maximize the application window, the application looks funny. You can find the application I wrote here.
http://web.ics.purdue.edu/~amohanty/4_ShellControl.zip
Also, I want to add the opacity property to the ShellControl[http://www.codeproject.com/cs/miscctrl/shellcontrol.asp] control. How do I do it? Senthil has not set the opacity property. I want my application to look little cool. So I want to have the opacity, which I can control. I guess it is possible to control the opacity of the elements of an application, which doees not affect the opacity of the whole application window.
|
|
|
|
|
Any help available Christian?
|
|
|
|
|
LOL
The general way to control the size of objects is the Anchor property. I set the right control to anchor in all four directions and got what I thought was acceptable. If you can't get what you want using these properties, then you need to override the OnSize event and size your controls manually.
I'm looking at the other problem now. As you say, the control does not support transparent colors. Not sure there's anything you can do about it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks..I think I will ask Senthil if anything can be done about the opacity property. Basically i think now I have to learn how to write a windows control library. Am I right? But I am not able to find a good tutorial to start with..
Anyway, great job, Chris..I really appreciate it. If I ever develop a commercial application I think I sud give you half of my money ..
Regards,
Amit
|
|
|
|
|
I have the vaguest recollection of being able to send a message to a control in the past where I got this error message for trying to set opacity, but I just can't remember the details. I hope it works out for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can I possibly use panel and write
this.tabControl1.Width=this.ClientSize.Width/3;
something like that..let me try and see
|
|
|
|
|
Yes, you can do that in your OnSize, for sure. That's the sort of thing I had in mind when I said to use OnSize.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
lil more on onSize method may help me, Chris..I am not sure how I want to do that.
|
|
|
|
|
Your form has an onsize event. It is fired when the form is resized. If you set up your code as you said to resize stuff in that event, then when the form is resized, the controls will be sized by your code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Worked...Worked...Worked.. ...Actually, that is the Resize method. Thanks..Gotta work for the opacity of the shellcontrol..Regards..Amit
|
|
|
|
|
Unless you want to make this collection public, so that anyone can use it in any way, I'd suggest adding methods for the bits you want to expose, for example, adding an ObjectCount property to Room that returns RoomObjects.Count would make more sense. Then an Add method that adds an object to the room, etc.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
VickyC# wrote:
Practically the RoomObjects is public. But does not appear.
It can't be practically public, either your instance of the class is public, or it isn't.
VickyC# wrote:
public class Room {
protected string _name;
public Room() { }
public string Name {
get {return _name; }
set {_name = value; }
}
public class RoomObjects : System.Collections.CollectionBase {
public void RoomObjects{}
public void Add(RoomObject roomObject) { List.Add(roomObject); }
.
.
.
public RoomObject Item(int Index) { return (RoomObject) List[Index]; }
}
}
and RoomObject is just another class.
This is a class within a class. Room.RoomObjects.xxx will only show static members, you'd need an *instance* of this class that is public to call non static methods like Add and Count. Does an instance of this class exist inside Room, or just the class itself ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was just thinking about this, it's not a program or anything (or in one...)......
Given a DateTime, how can I find the a DateTime for the following Friday in that week?
/\ |_ E X E GG
|
|
|
|
|
Use the DayOfWeek property to work out how many days ahead you need to go.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Try this simple test:
Drop a NumericUpDown control (nud1) and a Button (b1) on a form. Make sure that nud1.DecimalPlaces is set to 0. In the Click handler of b1, display the value of nud1 by doing MessgeBox.Show(nud1.Value.ToString()). Run the application and type 4.513 in nud1 and click b1. The MessageBox will display 4.513 as the value, but nud1 will contain 5. Now click the up arrow of nud1 and then click b1. The MessageBox will now display 5.513 and nud1 will contain 6. If you type a new value, say 17, into nud1, the decimal places will go away. The same type of problem shows up if you set nud1.DecimalPlaces to 3 and type 7.12345 in nud1 (the extra decimal places hang around).
You can get around this by using the NumericUpDown.Text property (it always gives the correct value). However, studio does not show this property in the properties window and it does not appear when performing a ‘code complete’ when typing. The Text property is an overridden property of UpDownBase.
This appears to be a big problem since all of the msdn examples for NumericUpDown use the Value property to retrieve the value of a NumericUpDown. Does anyone have any comments/opinion?
Thanks …
wjr@itt
|
|
|
|
|
Looks to me like the value property gives you the number of decimal places you asked for, and the Text property does not. Why is this a problem ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Take another look. The Value property, which is what they want you to use according to the examples, does not give what was asked for. In any case, nothing should give you something different than what is shown in the control.
wjr@itt
|
|
|
|
|
What you're basically complaining about is that the text box does not enforce the decimal places property. If you want that, then you should build a class on this one. Otherwise, the Value enforces the decimal places property, even if the entered text does not match it. I still don't see the issue. If you want the decimal places enforced in the text box, create a class. If you don't want it to work like this, set the decimal places value to something other than 0.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian,
When you get the Value property from the NumericUpDown, it is suppose to give you the value that is displayed in the control. The whole purpose of the NumericUpDown is to make things easy for you so that you do not have to check what the user is typing. It will check the min and max, the number of decimal places, and the characters that are type if you choose hex. I know that I can write my own class. I wrote my own numeric up down 10 years ago in Motif and have been using ever since. It's not hard to do, but why duplicate what the supplied classes are SUPPOSE to do for you? Again, the purpose of the NumericUpDown is to automatically enforce the limits set by the properties and give you a value that you can count on as being correct. If it does not do what is advertised, it is a problem.
wjr@itt.com
|
|
|
|
|
wjr@itt.com wrote:
Again, the purpose of the NumericUpDown is to automatically enforce the limits set by the properties and give you a value that you can count on as being correct. If it does not do what is advertised, it is a problem.
But the problem in essence is that the text box does not enforce the number of decimal places you asked for, right ? The Value property does not have a problem, except that it enforces what the text box does not. To my way of thinking, the decimal places property is provided to give you a value within a fixed range that you've requested, but if a use goes outside that, it rounds it for you. If this is not what you want, then you can either have no decimal place specification ( which means you can use the value property ), or you can write your own control to enforce it in the text box as well ( which would mean you could use the value property ).
As far as I can see, it behaves as advertised. The Value property gives you the value in the text box, after applying the rules that you asked it to. I understand that it's not doing what you want, but the Value property is NOT the problem, it's working fine, and overall, it works as the docs suggest. The problem is in what you were hoping for, which is why it's possible to derive your own controls, to get behaviour the framework does not provide.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian,
Please read the example carefully. The text box ALWAYS displays the correct value (the correct number of decimal places). When you retrieve the value from the text box using the Value property, it DOES NOT return what is displayed and it has the wrong number of decimal places. THE VALUE PROPERTY DOES NOT RETURN THE VALUE IN THE TEXT BOX. I can't make it any simpler than that.
|
|
|
|
|
Oh... I see what you mean now. I have to admit, I read through what you were saying, and got it backwards. So the text box is masked, and so the Text property works, but the Value is not reset at the same time.
I'd agree then, this is a bug, and it's still present in VS2005. I'll bring it up in Seattle.
Christian Graus - Microsoft MVP - C++
|
|
|
|