|
n = Convert.ToInt32(dr[0]);
|
|
|
|
|
How do I disable the child form control box, maximized box and minimized box.
I have codes like
childFrm.ControlBox = false;
childFrm.MaximizeBox = false;
childFrm.MinimizeBox = false;
childFrm.MdiParent = this;
childFrm.Show();
but it will still showing the grayed control box right below the parent control box.
Anyway of totally making it disappear?
thanx in advance
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
It will all disappear with:
childFrm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
|
|
|
It is a fresh installation.
If I have two files, test.aspx and test.asp, which include only a test words : This is test!
When load from this server, the test.aspx copy can pass and display This is test!. But the test.asp displays nothing but Fobidden error message?
Any idea?
Thanks
JW
DJ
|
|
|
|
|
Tehre is an execute permission setting on Default WEB site properties page
Home Diractory Tab
Execute Permissions have to be
Scripts and Executibles try this
|
|
|
|
|
Is there a difference between initializing variables this way ...
<br />
public class Something<br />
{<br />
private ArrayList list = new ArrayList();<br />
public Something()<br />
{<br />
...<br />
}<br />
}<br />
... or that way ...
<br />
public class Something<br />
{<br />
private ArrayList list;<br />
public Something()<br />
{<br />
list = new ArrayList();<br />
...<br />
}<br />
}<br />
Notice that I have only one constructor.
Regards, Desmond
|
|
|
|
|
With the second alternative you can catch exceptions thrown in the contructor.
|
|
|
|
|
Yes there is an important difference:
If you don't set the list field, the compiler set the field to null.
C# compiler automatically set all of reference variables to null vlues and you should set them to value that you want.
MJ Mirzazadeh.
MSCD.NET , JAVA Certified
|
|
|
|
|
One small addition:
C# automatically sets reference *fields* to null, not all reference variables. Within a class member (function, property etc), they must be explicitly initialized.
|
|
|
|
|
One other difference to note:
In C#, field variables are initialized before instance constructors fire, so in your first example, the 'list' object would be initialized before the public constructor fired, instead of after, as in the second example.
It's also interesting to note that VB.Net exhibits the opposite behavior (fields are initialized after the constructor fires).
|
|
|
|
|
Is there a way to make the ToolBar have a background image? I tried setting the BackgroundImage property but it doesn't work. Then i create a custom control derived from ToolBar and override OnPaintBackground() to paint the image. It doesn't work either. Any ideas?
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
Not every control supports every property. The ToolBar control doesn't make use of the BackgroundImage property, so it hides it from design-time designers like the PropertyGrid and code editors (if they check the BrowsableAttribute and EditorBrowsableAttribute like they're supposed to).
The ToolBar uses the ControlStyles.AllPaintingInWmPaint , so you'll either have to paint your background in OnPaint , calling base.OnPaint after (to "z-order" correctly), or handle the WM_ERASEBKGND in an override of WndProc . Another way to accomplish the latter is to set the TBSTYLE_CUSTOMERASE in an override for CreateParams then handle NM_CUSTOMDRAW notification messages in an override of WndProc . For more information on these latter ways, see the Windows Controls documentation in the Platform SDK, which you can read on MSDN Library online[^] (under the UI section).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
This is what i tried in my derived toolbar. The background color is changed and the buttons all appear normal, but when i hover onto one button, the next one disappear. You mentioned something about the z order. Is is the cause of the problem?
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if(m.Msg == 0x0014)
{
Graphics newGraphics = Graphics.FromHwnd(this.Handle);
newGraphics.FillRectangle(new SolidBrush(Color.Khaki), this.Bounds);
}
}
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
No, the "z-order" is the order of drawing on the "z axis". In 2D drawing, this doesn't really exist (which is why I put it in quotes). You still have to draw things in a certain order. Like, if you allowed for the defaulting painting and then drew your background, you wouldn't see any buttons because your background was drawn on top of the other buttons (control's that control their own painting might still be on top, though).
The only advice I can offer is to google the 'net for information on backgrounds and toolbars. Most of the examples you'll find will most likely be in C/C++/MFC, but once you override WndProc you're already down that path - handling windows notification messages and what-not.
You might try http://www.codeguru.com[^]. They would most likely have a lot of these examples, perhaps even some in C#. And if you read the articles here often, you might notice a few familiar names there, too.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your tips. I managed to come up with a solution below just in case anyone is interested, though it may not be very elegant.
public class MyToolBar : System.Windows.Forms.ToolBar
{
private int indexButtonOnHover = -1;
public MyToolBar()
{
}
protected override void OnMouseLeave(EventArgs e)
{
indexButtonOnHover = -1;
this.Invalidate();
}
protected override void WndProc(ref Message m)
{
if(m.Msg == 0x0014)
{
TextureBrush textureBrush = new TextureBrush(this.BackgroundImage);
Graphics newGraphics = Graphics.FromHwnd(this.Handle);
newGraphics.FillRectangle(textureBrush, this.Bounds);
return;
}
else if(m.Msg == 0x0201)
{
if(indexButtonOnHover != -1)
this.Invalidate();
}
else if(m.Msg == 0x0202)
{
if(indexButtonOnHover != -1)
this.Invalidate();
}
else if(m.Msg == 0x0200)
{
Point pointClient = this.PointToClient(Cursor.Position);
int count;
for(count = 0; count < this.Buttons.Count; count ++)
{
if(this.Buttons[count].Rectangle.Contains(pointClient) == true)
{
if(count != indexButtonOnHover)
InvalidateNonHoveringButtons();
indexButtonOnHover = count;
break;
}
}
if(count == this.Buttons.Count)
{
if(indexButtonOnHover != -1)
this.Invalidate();
indexButtonOnHover = -1;
}
}
else if(m.Msg == 0x000F)
{
}
base.WndProc(ref m);
}
private void InvalidateNonHoveringButtons()
{
foreach(ToolBarButton toolBarButton in this.Buttons)
if(this.Buttons.IndexOf(toolBarButton) != indexButtonOnHover)
this.Invalidate(toolBarButton.Rectangle);
}
}
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
Btw, i noticed ie's toolbar has this gradient background that is part of XP' themes. Do you have any idea how to achieve this effect?
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
|
I have windowsform that display Word document using DSOFramer activex from microsoft support website
and i put the code that load this doc at load event of the form, but it doesn't work
and when i added button to the form and made this button_click loads the word file it works
so i think that the form.load event is not suitable and i do not know how to make this file opens auomaticly without using the form load event
thnx in advance
|
|
|
|
|
It's worked for me in the past to simply override the Form.OnHandleCreated method (it's better to override in derived classes than handle events) for ActiveX controls using something like:
public class MyForm : Form
{
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
}
} The ActiveX control will most likely require a window handle (HWND ) in which to be sited (parented). Calling base.OnHandleCreate first makes sure that everything is set up correctly. This handler is called by CreateHandle after creating the handle.
It's possible that the DSOFramer requires something different, though. You should check the Microsoft KB[^] or any existing product site for that control for specifics.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
HI C# SAVVYS,
ANY BODY KNOW HOW TO SET THE SYSTEM TIME USING C#. PLZ HELP ME....ASLO ANY BODY KNOW HOW TO SHOW SERVER TIME DYNAMICALLY (WITHOUT REFRESHING THE WEB PAGE) IN ASP .NET.
THANKS IN ADVANCE
|
|
|
|
|
.NET is too high-level for things like setting the system time. You'll have to P/Invoke the native function SetSystemTime and re-define the SYSTEMTIME struct:
[DllImport("kernel32.dll")]
private static extern bool SetSystemTime(ref SystemTime time);
[StructLayout(LayoutKind.Sequential)]
private struct SystemTime
{
[MarshalAs(UnmanagedType.U2)] public short Year;
[MarshalAs(UnmanagedType.U2)] public short Month;
[MarshalAs(UnmanagedType.U2)] public short DayOfWeek;
[MarshalAs(UnmanagedType.U2)] public short Day;
[MarshalAs(UnmanagedType.U2)] public short Hour;
[MarshalAs(UnmanagedType.U2)] public short Minute;
[MarshalAs(UnmanagedType.U2)] public short Second;
[MarshalAs(UnmanagedType.U2)] public short Milliseconds;
} Fill-in an instance of the SystemTime struct and call SetSystemTime(ref obj) , where obj is the instance of your struct.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Anybody know whether ASP.NET ADO.NET and C# cum Microsoft.Net Framework can be run from WINDOWS NT 4 + II4 Platform?
Or where can I find the information from M$' sites?
Thanks
DJ
|
|
|
|
|
Sorry... no. Maybe... not. No to ASP.NET; however other things using .NET Framework redistributable (windows forms) will.
Check here.[^]
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
hmm... i never noticed you can't run .net on 64-bit computers... i hope this is fixed soon!
|
|
|
|