|
And/or set Opacity to 0.
These all seem like kludges, though. It seems like there should be a way to tweak the create params.
Matt Gerrans
|
|
|
|
|
Setting Opacity to 0 is
My two line suggestion should be the easiest possible way of doing it.
You can override the CreateParams property like this:
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
return cp;
}
}
I never actually overriden this property before. You can give it a try.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
That doesn't quite work by itself (I replaced "// change" with "cp.Style = cp.Style & ~1;"); you still see the window flash for a fraction of a second on startup.
Matt Gerrans
|
|
|
|
|
Would setting the Location property in the Designer to have a Y value of, say, 3000, to put it off the display entirely, keep the flash from being seen?
|
|
|
|
|
I think that's just another kludge, so it would be just as well to stick with the minimized+not-in-taskbar.
Most of the time the object oriented wrapping of the underlying Windows API mechanics is a benefit, but there are few rare cases when some things are a little more difficult. Hiding the main window on startup was also not obvious with MFC and Borland C++ Builder. If you ever wrote Windows apps "in the raw" it was pretty easy to control such things, but all the frameworks hide those details from you. Nevertheless, the productivity gain makes it well worth the price of dealing with the occassional quirk like this. After developing a few graphical apps in C#, there isn't much draw to going back to using the API in C.
Matt Gerrans
|
|
|
|
|
I have a RichTextBox in an app
When the app starts it does
richTextBox.LoadFile( somefilename );
and when the app quits it does
richTextBox.SaveFile( somefilename );
which for formatted text works great (the contents persists between sessions, which is what I want)
However, if I paste in an object (say a bitmap from Paint) then it saves happily (I can load the resultant rtf file into word and see the image) but when the app reloads it, the image is gone
I've tried
richTextBox.LoadFile( somefilename , RichTextBoxStreamType.RichText );
but it doesn't seem to make any difference
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
We've seen this problem. I believe if you copy an image from mspaint, the RTF is saved differently than if you copied an image out of Word or a web browser. Give it a try and see for yourself.
Basically, when you're copying image data from paint, the RTF emitted is some simple codes basically telling it to embed the image data on the clipboard. It does NOT embed the image as a WMF as it should. But when copying an image out of Word or many other apps, the data is written as a WMF into the RTF, thereby keeping it persistent between sessions.
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
Hi All
I have a windows service that runs code based on a timer. However, the tick event on the timer dosen't fire. I'm writing to the event log all the way through, and the timer is definetly wired, but the tick event never fires.
To test this out properly, I started a new project with nothing but a timer in it, and a write to the event log when it ticks. Same result. On an Interval of 10 seconds we go 2 mins and tick event has still not fired.
Can anyone tell me why, or a way to get around this?
Thanks in advance
Doug Wilson
|
|
|
|
|
Nevermind - solved my own problem
For those who come across the same problem - I was using the wrong timer. A windows forms timer ticks, a system timer elapses.
Using a system timer works from within a service, a windows forms timer doesn't.
Doug Wilson
|
|
|
|
|
Of course it doesn't, cause as MSDN states: "This timer is optimized for use in Windows Forms applications and must be used in a window." or "It requires that the user code have a UI message pump available".
So always read the documentation thoroughly, cause almost every information needed is written down there
www.troschuetz.de
|
|
|
|
|
You're using System.Windows.Forms.Timer. It has no use in Windows Service.
Using System.Timers.Timer class instead.
You must also change Timer_Tick eventhandler by Timer_Elapsed eventhandler
That's so simple!
Good luck!
|
|
|
|
|
I have started doing some research for a relational database modeller. For this I'm gonna need the application to be able to do some drawing. I have been testing some simple things with GDI+ but I started thinking about the possibility of using managed DirectX.
What do you think, would I get a performance gain by using DirectX compared to using regular GDI+? Or maybe DirectX would put a too high system requirement for just using the application.
|
|
|
|
|
G.Ringbom wrote:
What do you think, would I get a performance gain by using DirectX compared to using regular GDI+?
Yes, but developing the UI will be much harder. DirectX is really targeted at easing game development, not easing UI development.
For a DB modelling tool, I can't see why you would need high frame rates. GDI+ is more than capable of drawing complex screens at decent speed for an editor.
As an example, I created recently a graphical editor for a rule engine, all done in C# (with a few P/Invoke calls) and the speed is very good on an old test machine (AMD 650MHz - 256MB RAM - PCI Riva TNT2 card) that we have here. Even on the biggest files, it's very usable.
Yes, even I am blogging now!
|
|
|
|
|
Daniel is right. Even programs like Visio use GDI
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
As an alternative, you *could* use Avalon instead. It's (should be) easy to use and has power of DirectX (it's based on it). This has, however, several drawbacks:
1. Development difficulties (You must own Whidbey and Avalon/WinFX CTP disc).
2. Release difficulties (you can't release your application until Avalon/WinFX is officially released (for Longhorn and XP).
3. High-spec client-machine needed as Avalon tends to need quite a machine (1 GHz processor, 256 MB Ram, DirectX 9 supporting video card and so on) though you can setup Avalon to work on a low-end machine, too.
|
|
|
|
|
try
{
some code
}
catch(Exception ex)
{
some code
}
How can I loop with "forEach" statement through all exceptions ?
|
|
|
|
|
???
a catch block only catches one Exception. Why do u whant to loop and where?
I don't understand your request
spif2001
|
|
|
|
|
Hi,
Here is one example for SQLError
try
{
some code
}
catch(SqlException ex)
{
foreach(SqlError sqlError in ex.Errors)
{
some code
}
}
Sometimes you get more than one exeption at the same time ( especially SQL for example )
|
|
|
|
|
hi,
As was already mentioned, catch "catches" only one Exception. I think you are trying to do something like :
<br />
try<br />
{<br />
if(stg)<br />
{<br />
myBadFunctionThrowsMySpecificExcpetion();<br />
}<br />
else<br />
{<br />
i= i/0;
}<br />
}<br />
catch(MySpecificException ex)<br />
{<br />
}<br />
catch(Exception ex)<br />
{<br />
}<br />
When exception is raised in try block, it is catched in "closest" catch if throwed exception is (in meaning that operator is would return true - same type or derived class) the same as declared in catch block. If exception of diferent type is thrown, then it passes thru first catch block to another (if present),.. etc. You must write catch blocks from specific to most generic; if you wrote catch for System.Excpetion first, all exceptions would be handled in this block. No other would have chance to trap error.
I only hope this is answer to your question
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
You are close to the problem, but i want get all error messages from all risen errors there. In the last message I have wrote an example for SQL tasks. Here it works, because you can assign a specific error, so I think it shpuld be possible to loop within all possible errors ( I need the name for the element and elements-> foreach(element in elements))
|
|
|
|
|
how about:
try
{
}
catch(Exception e)
{
Exception ex = e;
while(ex != null)
{
Console.WriteLine(ex)
ex = ex.InnerException;
}
}
|
|
|
|
|
Hi,
A question:
How can I create a popup with a textbox or a combobox in it?
e.g. in MS Access 2003 there is such a thing if you do
a right click on a table column to add a filter...
Thanks in advance!
Hornox
|
|
|
|
|
Don't know if the following will work, but maybe you'll give it a try.
Create a simple Form, which contains the TextBox, ComboBox or whatever you want.
Catch the MouseDown or MouseUp event of the controls ,which should open the popup form after a right-click on them, and determine whether the right button was clicked.
If so create an instance of your form, assign the mouse coordinates to the Location property of your form and show it.
www.troschuetz.de
|
|
|
|
|
Hi All,
How to spawn a UI Thread in C#.
I want to show window having ProgressBar while starting application(from main window constructor),application takes some time to start.
The window having progressbar should run in different thread having it's own message que and all.
Thanks
TusharM.
|
|
|
|
|
Maybe try it the other way around. You have a "splash" type screen which is your main constructor. It can load fast as it is small. It fires off a thread that starts the loading of the main app which uses delegates or some such to report back on the loading progress.
Here is an article that may help you out; A Pretty Good Splash Screen in C#
regards,
Paul Watson
South Africa
The Code Project
|
|
|
|