|
I am not aware if the .NET Runtime (the v2 one) does run the 1.1-code itself (in that case, there should be no performance hit) or if the two runtimes interop (in that case, there WILL be a performance hit) in some kind.
Interesting question, does anyone have some answers?
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
The 1.1 assembly will run in the 2.0 runtime; so there is no impact on performance.
|
|
|
|
|
Some of my forms are taking some time to fully draw (say 1-2 seconds).
During this time, the form flickers, and I can see the controls which have been drawn briefly as black outlined blobs on the screen. This only lasts a second or so, but does not look very professional?
What can I do?
I have tried editing the form Visible properties during Load ..
Form_Load()
{
this.Visible = false;
// rest of code to build and bind controls
this.Visible = true;
}
but it doesn't seem to make any difference at all. I figured putting these in the constructor wouldn't make any difference, as the Load() event is first triggered just as the form is becomming visible anyway!
Any suggestions?
Thanks
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
|
|
|
|
|
I don't know exactly why your form flickers, there can be several reasons, but usually it helps if control is set to use double buffer. You can turn on double buffering by add
this.SetStyle(System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer, true);
to contol's constructor.
If you already have double buffer turn on and it still flicker it can be so because of too complicated rendering, slow graphical card or maybe there are some flaws in code. To find flaws in your code we need to see it.
"Please! For the love of God! Can you help me unlearn VB?" -Jeremy Falcon
-- modified at 9:41 Friday 3rd February, 2006
|
|
|
|
|
hmm ... there is no "ControlStyles.OptimizedDoubleBuffer"
only "ControlStyles.DoubleBuffer"
Is the optimised one a customised effort? or a .NET 2.0 feature?
I have tried using the method with DoubleBuffer, but it has had no effect.
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
|
|
|
|
|
Martiankeeper wrote: Is the optimised one a customised effort? or a .NET 2.0 feature?
Yes it is a .NET 2.0 feature. In .NET 1.1 it was ControlStyles.DoubleBuffer and it should have the same effect.
"Please! For the love of God! Can you help me unlearn VB?" -Jeremy Falcon
|
|
|
|
|
Second Question ..
All of my forms inherit from a Base_Form class.
If I place:
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
in the constructor for Base_Form .. would that then enable it for all objects in my project?
Do I have to set the Styles for EVERY user control, or just the form?
Do I have to set the styles for EVERY inherited form, or just the Base_Form?
thankyou again
Martiankeeper
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
|
|
|
|
|
Martiankeeper wrote: Do I have to set the Styles for EVERY user control, or just the form?
Do I have to set the styles for EVERY inherited form, or just the Base_Form?
1. Yes (but not the UserPaint option, only on ones you draw from scratch)
2. No
xacc.ide-0.1.2.3 Now with full keyboard customization
|
|
|
|
|
Ok, so let me get this straight.
I have a Base_Form class, which is a Windows Form.
In the Base_Form constructor I put the code:
this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
I then create a form called "MainForm" which inherits from "Base_Form".
I place a number of tab controls and listview controls.
1) Do I need to add any more code for DoubleBuffering to work? (do I need "this.UpdateStyles();" ???)
2) Do I need to manually apply double buffering to the tabcontrols and listview controls?
3) Do I need to apply double-buffering to MainForm, having already placed it in Base_Form?
4) Am I correct in placing the double-buffering code in the constructor, or should it be in the "Load" event?
Last Question.
5) I create a User Control class called MyControl. I drop MyControl onto MainForm. Do I need to add the code "this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);" to the MyControl
class code, or do I set it from the MainForm class' code?
Thankyou ever so much. I know this is a lot of questions, but I really want to fully understand this.
Martiankeeper
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
-- modified at 10:25 Friday 3rd February, 2006
|
|
|
|
|
Martiankeeper wrote: 1) Do I need to add any more code for DoubleBuffering to work? (do I need "this.UpdateStyles();" ???)
General answer is YES. See MSDN Doc[^]
Martiankeeper wrote: 2) Do I need to manually apply double buffering to the tabcontrols and listview controls?
You can't. It's protected property. You can apply double buffering only to your own controls(which of course have to inherit(directly or indirectly) from System.Windwos.Forms.Control class).
Martiankeeper wrote: 3) Do I need to apply double-buffering to MainForm, having already placed it in Base_Form?
NO. It's inherited. See the protected property Control.DoubleBuffered to see if your form is double buffered.
Martiankeeper wrote: 4) Am I correct in placing the double-buffering code in the constructor, or should it be in the "Load" event?
It's OK in constructor.
Martiankeeper wrote: 5) I create a User Control class called MyControl. I drop MyControl onto MainForm. Do I need to add the code "this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);" to the MyControl
class code, or do I set it from the MainForm class' code?
You need to add "this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);" line and "this.UpdateStyles();" line to constructor of your MyControl class. Once again, DoubleBuffered property is protected so you can't set it from other class.
There is a nice article[^] on how to creating your own control.
Hope this helps, I'm not native english speaker, my english is limited therefore I can't be more descriptive.
"Please! For the love of God! Can you help me unlearn VB?" -Jeremy Falcon
|
|
|
|
|
Thankyou very much.
Couldn't have asked for a better response.
PS - Your english is perfectly good. I wouldn't have known if you hadn't told me
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
|
|
|
|
|
Martiankeeper wrote: 2) Do I need to manually apply double buffering to the tabcontrols and listview controls?
You should also look at ListView.BeginUpdate() and ListView.EndUpdate() method to disable and enable redrawing of ListView. Also Control.SuspendLayout() and Control.ResumeLayout() could be helpful.
"Please! For the love of God! Can you help me unlearn VB?" -Jeremy Falcon
|
|
|
|
|
hi to all,
how can i split a string value with a seperator of many character.
like this :
string MyString = "abc|@def|@hij|@klm|@"
after the split i want the following result :
abc
def
hij
klm
best regrads and thanks in advance
fady
|
|
|
|
|
Try:
string test = "abc|@def|@hij|@klm|@";
char[] seperators = {'|'};
string[] splitted = test.Replace("@","").Split(seperators);
Then you get an array of 5! strings, the last is empty.
Greetings,
Ingo
------------------------------
An bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
If it is the same string sequence, String.Split will do the job.
string[] myStrings = myString.Split(new char[] { '|', '@' }, StringSplitOptions.RemoveEmptyEntries);
Not that the StringSplitOptions is new to 2.0. If you are still in 1.1, you have 2 choices:
1- filter the empty strings when reading the array.
2- Use Regex.Split instead:
string[] myStrings = Regex.Split(myString, "[\|@]+");
The regular expression means "split on | or @, which may appear one or more times. Unfortunately, the Regex one leaves an empty entry at the end, because your string finishes with the "|@" sequence.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Hi!
What I usually do is to replace the separator strings with single characters that do not otherwise occurr inside the string and then perform a regular Split.
Something like this:
string MyString = "abc|@def|@hij|@klm|@";
string MyNewString = MyString.Replace("|@", "\0");
string[] Parts = MyNewString.Split('\0'); You should get the expected result.
You have to be careful, though: Since your string ends with a separator, you'll get an additional empty string as last entry in your result array!
Regards,
mav
|
|
|
|
|
|
I must admit that I wasn't sure that '\0' would behave nicely until I tried.
But now that I actually tried it there's no real reason why it shouldn't work - .NET strings aren't \0-terminated, so \0 should be a character like every other. Only difference is that you'll have a hard time trying to insert a \0 manually in your text
Regards,
mav
|
|
|
|
|
|
I am writing a program that takes a grid and use its contents to print out a customized printout.
I want the column lengths on my printout to be the same as the column size on screen but my reporting software requires the length in inchs.
How can I convert the column width property of the grid into inchs?
|
|
|
|
|
Then you need to know the resolution of the screen, e.g. the ppi (pixels per inch) value. The most commonly used standard value for this is 96 ppi.
Just divide the length in pixels by the ppi value, and you get the length in inches.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Then you need to know the resolution of the screen, e.g. the ppi (pixels per inch) value. The most commonly used standard value for this is 96 ppi.
But this is not the same for every computer. You can get the DPI with the DpiX and DpiY properties in the graphics Object.
------------------------------
An bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
hi
I need some small projects or a site where there is a exercise for C# so that i can develope myself in C#.
sasi
|
|
|
|
|
The pick up a book or two on C#. They'll walk you through those first "starting out" apps.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|