|
Hi all
I want to make a user defined control which combine a textbox and DateTimepicker. I write the following code for the Resize event
Size wholesize = this.Size;
int x = wholesize.Width;
wholesize.Height = 21;
Point location = new Point(x - 20, 21);
this.calendar.Location = location;
Size newsize = new Size(wholesize.Width-20, 21);
this.textbox.Size = newsize;
But this code doesn't work, could anybody tell me how to redraw the user control, when I resize it???
Thanks in advance!
Asura
|
|
|
|
|
Hmmm... you give us some code which you say doesn't do what you want it to do. But you also don't describe what you exactly want to do... Are we going to guess what you want?
You'll have to explain a bit more if we should help you. But here is a more general tip:
Instead of calculating the new sizes yourself you should use the docking and/or anchoring mechansims of .Net controls. If you want a DateTimePicker at the top and a TextBox filling out the rest of the control you would assign DockStyle.Top to the Dock property of the DateTimePicker and DockStyle.Fill to the TextBox.
Note that when using docking the order of the controls in the form are relevant (and can be changed via the designer).
|
|
|
|
|
Guys,
I need your help..
I need to modify the difficulty level of the lunar lander game..
is it possible to change the dy to .5?? is there any better suggestions in here??
private void timer1_Tick(object sender, System.EventArgs e) {
//code that should happen on every timer tick (10 times/sec)
//account for gravity
dy+= .5;
//increment score for being alive
score += 100;
//show ordinary (no flames) lander
picLander.Image = myPics.Images[0];
moveShip();
checkLanding();
showStats();
} // end timer tick
thanks...
|
|
|
|
|
What implementation of this game are you referring to?
But yes, in general it helps just raising the gravity to make it harder.
|
|
|
|
|
hello,
i have a panel which i draw stuff on using the DrawPolygon method of the Graphics object. i have a collecition of Building objects. each building object has an array of points associated with it. On the paint event of the panel object, i iterate through all the buildings and draw them one by one.
the question is, 1) how do i know if the mouse is within the bounderies of one of the building?
2) i use the transformation matrix to zoom in to the drawing. will the answer to number 1 work when i zoom in?
thanks,
michael
|
|
|
|
|
Hi!
When I start remote host as the service, it stops giving me the messsage that the service has got no work.Please help if anybody has idea about this.
Akshay
|
|
|
|
|
can anyone help me.I get problems with DataGrids not firing their PageIndexChanged event.Here is code which i m trying:
private void DataGrid1_OnPageIndexChanged(object sender,System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataSource = oDv;
DataGrid1.DataBind();
}
|
|
|
|
|
What's the difference between a struct and a class? why should i use a struct?
|
|
|
|
|
|
struct is value type and class is reference type ... this is the main differece. Martin
|
|
|
|
|
WTF?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Sorry Tim, but he is right!
|
|
|
|
|
The only difference between a struct and a class is that the members of a class default to "private" while the members of a struct default to "public".
Often, for simple data containers, people still use a struct.
i.e.
struct BOB { int a; int b; };
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
ROFL... How the **** did I end up here.
Sorry guys. LOL.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
Hi,
Methods in an interface must be public?
If i have a public method in an interface, can i make this method "internal" (or any other access parameter) in a class derived from the interface?
ie:
public interface myinter
{
public void MyMethod(){}
}
public class myclass : myinter
{
internal void MyMethod(){//my code}
}
|
|
|
|
|
Heinz Suez wrote:
Methods in an interface must be public?
Yes, that is the point. It is defining the external interface* to something. In other words, it is defining the interface* (or part of the interface*) to your class that other classes use.
Heinz Suez wrote:
If i have a public method in an interface , can i make this method "internal" (or any other access parameter) in a class derived from the interface ?
No. You cannot. This is because the class would then no longer support the interface it advertises as supporting.
Do not confuse "interface" with the C# keyword "interface ". An interface is another way of saying how an external entity sees the class. You provide an interface with any public methods. An interface is a way of defining a common set of public methods or properties that a number of classes support.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
First of all your code won't compile
And yes all members of an interface must be public visible to everyone using this interface. But you can restrict them ONLY to explicit interface users:
public interface ITest
{
void TestA();
}
public class Class1 : ITest
{
void ITest.TestA() {}
}
static void Main()
{
Class1 c = new Class1();
c.TestA();
ITest t = c;
t.TestA();
}
|
|
|
|
|
I can't seem to figure out how to get the selected date from a MonthCalendar. The DateTime picker has a value property, but I can't find the same for the MonthCalendar. How do I get the selected date from the MonthCalendar?
Thanks
|
|
|
|
|
hope this helps,
add a dateselected handler and use the eventargst oget teh datetime of the selected data, then just use the datatime properties.
<br />
<br />
private void monthCalendar1_DateSelected(object sender, System.Windows.Forms.DateRangeEventArgs e)<br />
{<br />
this.textBox1.Text = "Date Selected: Start = " +<br />
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();<br />
}<br />
<br />
regs,
g00fy
|
|
|
|
|
Hi all, I have an application in C++ (unmanaged) that was built to use the IQueryCancelAutoPlay interface and the AllowAutoPlay function to allow the application to determine whether it wants to handle media inserted into the CD/DVD drive or let Windows AutoPlay the media.
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iquerycancelautoplay/iquerycancelautoplay.asp for details.
I want to create a C# application that would do this very same thing. Unfortunately, I have not been able to find anyone who has done this through Google or MSDN.
Would anyone have an idea of where to start? I.e., any methods of importing/invoking the interface into C# would be great.
Thank you!
C
|
|
|
|
|
I am trying to debug a Form. I set a breakpoint on a method and then started the debugger. Under the debug menu I added a Watch1
window. Then I went into MSDN help-- it says I can get the variables into the watch window by dragging them in. Tried a number of things (drag from class view, from Form, but I can't seem to get anything in. What the heck am I missing here -- thanks a lot....
ps- as you can judge from my post I'm a beginner so go easy.....
|
|
|
|
|
To drag and drop a variable, you first have to select it. Press ctrl (for word selection) and click on it. Then drag it.
In the code you can right click on a variable and add it to the watch.
You can just type the name of the variable in the watch window if everything else fails.
---
b { font-weight: normal; }
|
|
|
|
|
I'm not using an image list so this might not be so easily done, but I'm not sure. I'm making a Word Processor in C# using Visual Studio .NET 2003 Professional. But when I start to use some of the toolbar icons (bitmaps) they have a gray or silver background like the ones for bold, italic, right-align, and so forth. How do I get rid of that background color. Are there any icons like this that are free?
Thanks
|
|
|
|