|
is there a way to give basic windows controls a better look, like a skin ect.. or do you have to create a custom control?
if I have to make a custom control anyone know of a good sample?
thanks
j
|
|
|
|
|
There are heaps of samples on this very site. I think XP has some options for controls, but overall, if you want to change how they look, you need to draw them yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello all,
After reading almost all tutorials on splash screen for C# I'm quite confused which aproach to take. So I want to ask you what would be the best way. Personally, what I've been thinking is doing something like this:
1. In Main() start the splash thread
2. Run the Main form thread
3. main form thread sends signals to the splash thread about the progress
4. main form sends a signal to the splash thread that it has finished and the splash thread closes itself
The thing is that I've done some threading recently but I haven't actually encountered how to call object methods on different threads. Another thing which I'm not sure about is, should the function which is to be called for the start point of the thread call Application.Run(SplashThread) for the splash thread and Application.Run(MainForm) ? Any advice is greatly appreciated.
|
|
|
|
|
I don't see the need for another thread. Your main thread can just open a window which shows the splash screen, then close it using either a timer, or at a specific point during initialisation ( i.e. just before the main app is ready to show itself ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
But if I show the splash using Application.Run(Splash); the function will return when the splash is closed, am I right? If it's that way, then I'm in a deadlock. That's why I resort the threads.
|
|
|
|
|
1nsp1r3d wrote:
Application.Run(Splash);
Why would you do this ? I'm talking about a modeless form being shown by your application, during startup. Sure, you can use a thread, it just seems like overkill to me.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Because using the same message pump for both the splash screen and the main application window might cause the splash screen to freeze if there is some heavy duty initialization involved.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
How does a splash screen 'freeze' ? I guess if you move something in front of it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes. And if you intend to show some dynamic text in the splash screen window.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
You could do all your initializing in the Main() function.
Something like as follows:
static void Main()
{
// Create splash
fclsSpash splash = new fclsSplash();
splash.Show();
// Create main form
fclsMain main = new fclsMain();
// Initialize this
splash.SetMessage("Initializing this.");
main.InitializeThis();
// Initialize that
splash.SetMessage("Initializing that.");
main.InitializeThat();
// Close splash
splash.Dispose();
// Show main
main.Show();
// Start application
Application.Run();
}
-Chris
|
|
|
|
|
Hello,
I did solve my problem with the initial structure. So this is what I'm doing in Main():
1. Create Splash thread
2. Start Splash thread
3. Create Main Window Thread
4. Start Main Window Thread
5. Hide Main Window
The thing which I'm working now is to implement an event which will signalize the splash screen that main is ready and it should close itself and Main form should appear.
|
|
|
|
|
How do I check id MDI Form is activate?
|
|
|
|
|
//
// code in your MDI parent form (not tested)
//
public MDIParent() {
...
mdi = new Form()
mdi.OnActivated += new EventHandler(MdiOnActivated);
// ...or similar name of this event, I'm not sure
}
void MdiOnActivated(object o, EventArgs e) {
Form activeMdi = (Form)this.ActiveMdiChild;
...
}
|
|
|
|
|
oh - and if you want to check if MDI is active, just compare:
if (mdi == this.ActiveMdiChild)
// mdi is active
else
// mdi is inactive
|
|
|
|
|
This snippet activates the paper feed but does not result in any printed text.
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using System.Drawing.Printing;<br />
<br />
namespace _316CH11<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.TextBox txtText;<br />
private System.Windows.Forms.Button btnPrint;<br />
private System.Drawing.Printing.PrintDocument printDocument1;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.txtText = new System.Windows.Forms.TextBox();<br />
this.btnPrint = new System.Windows.Forms.Button();<br />
this.printDocument1 = new System.Drawing.Printing.PrintDocument();<br />
this.SuspendLayout();<br />
this.txtText.Location = new System.Drawing.Point(0, 0);<br />
this.txtText.Multiline = true;<br />
this.txtText.Name = "txtText";<br />
this.txtText.Size = new System.Drawing.Size(176, 125);<br />
this.txtText.TabIndex = 0;<br />
this.txtText.Text = "";<br />
this.btnPrint.Location = new System.Drawing.Point(0, 136);<br />
this.btnPrint.Name = "btnPrint";<br />
this.btnPrint.Size = new System.Drawing.Size(176, 23);<br />
this.btnPrint.TabIndex = 1;<br />
this.btnPrint.Text = "&Print";<br />
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);<br />
this.printDocument1.DocumentName = "NetDocument11-1";<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(292, 262);<br />
this.Controls.Add(this.btnPrint);<br />
this.Controls.Add(this.txtText);<br />
this.Name = "Form1";<br />
this.Text = "Form1";<br />
this.Load += new System.EventHandler(this.Form1_Load);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new Form1());<br />
}<br />
<br />
private void btnPrint_Click(object sender, System.EventArgs e)<br />
{<br />
printDocument1.Print();<br />
}<br />
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)<br />
{<br />
Font fnt = new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel);<br />
e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, 0, 0);<br />
e.HasMorePages=false;<br />
}<br />
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
<br />
}<br />
}<br />
}<br />
Any suggestion on what might wrong here?
Most people are willing to pay more to be amused than to be educated--Robert C. Savage, Life Lessons
Toasty0.com
Ladder League (beta)
My Grandkids
|
|
|
|
|
Maybe it is printing outside the margins of the page.
Try: e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, e.MarginBounds.Location);
-Chris
|
|
|
|
|
cmaissan wrote:
Try: e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, e.MarginBounds.Location);
No joy. Tried it and get the same behavior. Thank you for the suggestion.
Jerry
Most people are willing to pay more to be amused than to be educated--Robert C. Savage, Life Lessons
Toasty0.com
Ladder League (beta)
My Grandkids
|
|
|
|
|
I m not finding solution to this problem. Can anybody please help me regarding this problem?
I need to obtain ip address and computer names of all machines of a LAN, which are ACTIVE in the network. The problem has to be solved in C#.
Aakash
|
|
|
|
|
Hey buddy, I did post a reply to your original post. You could have asked for more information instead of posting it again
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
sorry, i didnt mean to hurt you mr. senthil kumar. But i am trying from past 2 weeks on that context. Suggestions from this forum always helps me. Thanks to everyone.
Aakash
|
|
|
|
|
|
Hi Friends...
I wanna create a toolbar on my windows taskbar and add its name to system context menu of taskbar Like QuickLaunch,Address and Windows Media Player toolbar. My toolbar
may consists a Textbox and a button just like 'Google Deskbar' Application.
Can anybody help me ?
|
|
|
|
|
i wanna do the same thing,
if you got some thing, can you mail it to me,thx
gavin@m165.com
|
|
|
|
|
In working on a small C#.net program that starts another program via rundll32. This program performs an operation and then opens a IE page showing some results. I would like to be able to close this IE process after the WaitForExit() call.
Process proc = new Process();<br />
ProcessStartInfo processInfo = new ProcessStartInfo("rundll32.exe");<br />
processInfo.Arguments = Config.DLL_ARGUMENTS;<br />
proc.StartInfo = processInfo;<br />
proc.Start();<br />
proc.WaitForExit();<br />
I know how to get a list of processes running, but how do I know which was the IE started by my other proc. call??
Thanks for any help!
|
|
|
|
|
You'll have to get the list of processes, launch your .DLL thing and wait for it to terminate. Then enumerate the processes again, comparing the list to the one you have stored. You'll be able to find the IE instance that was launched then.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|