|
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
|
|
|
|
|
|
you can grab this book from MSDN website when you register your copy of C# Express
Microsoft® Visual C#® 2005 Express Edition: Build a Program Now
|
|
|
|
|
I know that you can get ISO 8601 date/time format using DateTimeFormatInfo.SortableDateTimePattern.
From the VS help on DateTimeFormatInfo.SortableDateTimePattern we can get:-
"This code produces the following output.
CULTURE PROPERTY VALUE
en-US yyyy'-'MM'-'dd'T'HH':'mm':'ss
ja-JP yyyy'-'MM'-'dd'T'HH':'mm':'ss
fr-FR yyyy'-'MM'-'dd'T'HH':'mm':'ss"
However, there does not seem to be any mention of the timezone extension. i.e. in the format
YYYY-MM-DDThh:mm:ss±hh:mm
How can I add the ±hh:mm based on the current timezone location.
Thanks,
Liam
|
|
|
|
|
Just add zzz to the format string.
---
b { font-weight: normal; }
|
|
|
|
|
I want my application to start maximised and I want the Maximise(resize) button beside the close X button to be disabled. How would you do this?
In the end we're all just the same
|
|
|
|
|
Set the WindowState (in the properties) to Maximized and the Maximize Box to false but you can change the windowstate stil by doubleclicking on the formheadline. To disable that you have to catch the forms resize event and than set the windowstate to maximized.
Greetings,
Ingo
|
|
|
|
|
i am looking on the net for a long time for an example code that shows how can i resolve Channel in c#.
does anybody know?
thanks.
|
|
|
|
|
I have created a form which will give the user CPU info.
I have a button called "btnCPUInfo" and I want it when clicked to display information on the CPU speed on "txtCPUSpeed" textbox and in "txtCPUCore" This will give the CPU core name. and Finally I want thwn button "btnCPUInfo" is clicked a list box called "lstCPUCore" will populate with the number of CPU cores.
How would you do this?
In the end we're all just the same
|
|
|
|