|
SledgeHammer01 wrote: flag enums don't play nicely with ... Winforms.
I haven't had that problem.
|
|
|
|
|
As stated above, use an enum for your bool s. Something like:
[Flags]
public enum MyBools : int
{
MyBool1 = 1,
MyBool2 = 2,
MyBool3 = 4,
MyBool4 = 8,
...
MyBool10 = 512,
}
public bool HasBool(int sumOfBools, MyBools specificBool)
{
return ((sumOfBools & specificBool) > 0);
}
|
|
|
|
|
Bernhard Hiller wrote: return ((sumOfBools & specificBool) > 0);
As a general test I prefer to test against the provided value (specificBool) rather than 0, because the specificBool may have multiple bits set.
Plus, in .net 4 (if you use that), there is the built-in Enum.HasFlag Method.
modified 25-Nov-11 10:26am.
|
|
|
|
|
If you want this to cover a flag uint from interop or something else where you don't want an enum, you can do something like
public struct Flags {
public uint Value;
public bool this[int i] {
get { return 1 & (Value >> i); }
set { uint mask = 1 << i; Value = (Value & ~mask) | (value ? 1 : 0) << i; }
}
}
... to provide indexed access to a set of flags.
|
|
|
|
|
But I think that can only test one bit at a time.
|
|
|
|
|
I have a desktop application developed in c# .net for winows 7 opearating system.Will I be able to install the same application on my tablet pc and use it.It has user actiona like button click how will this events be handled in tablet pc? Can some one help me in this front.
|
|
|
|
|
What happens when you try it?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
A button click is still a button click whether or not a finger or a mouse pressed it.
|
|
|
|
|
hello please help me to make md4 Hashe in c#.
i Find some codes but not work Correctly.
i want C# code for Make Md4 Hash and me love Summary code
|
|
|
|
|
You do realise that MD4 was smashed like 20 years ago? If this is a new application, I would suggest you use SHA1, or at least MD5. If you really need to implement MD4 to support an older app, MD4 - Koders.com[^] is an implementation that is open source.
Hope this helps.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
yes i want MD4 realy.
but can not run this code
i want real project that can run in computer
|
|
|
|
|
Well, you're not going to get one because, as it's already been said, MD4 has been useless for the last 15-20 years because of its weaknesses. You'd probably be the 20th person on this earth still using it.
|
|
|
|
|
i understand md4 is bad is very bad but i nescery md4
|
|
|
|
|
Presumably someone told you to do it that way for business need.
If so I would research the relevant problems with that and then present that to that person and insist that they sign off on that document themselves and then you keep a record of it. That way when (not if) a problem occurs you are in the clear.
|
|
|
|
|
Hi !
Is There Help to Find the Maximum Value in A Row of A DataGridView .
Thanks In Advance !
|
|
|
|
|
No.
A DataGridView just holds Columns, it does not assume those Columns hold data types that are comparable amongst themselves.
|
|
|
|
|
You'll have to teach it how.
|
|
|
|
|
who's a good datagrid, here have a nice treat
|
|
|
|
|
DataGridView was not designed for data manipulation.
I would suggest you write an SQL query or Stored procedure that uses the MAX function and then call it with the Command.ExecuteScalar() method.
|
|
|
|
|
Quote:
You'll have to teach it how.
Yes , You are Right !
in fact I shouldn't to use any database , otherwise , it was simple than i want to do this now !
in any case I should do it with help u !
Regards !
|
|
|
|
|
Hi all! I am creating tab pages and adding them to a tab control. When setting the text for a tab page, the part of the tab page where the text is shown always stretches to show the full tab page title. But some of the titles are very long and would like to know how I can limit the width of the part of the control where the title is shown so that not all characters will be shown. I think this will enable the tab control to show more tab page titles at a time. Thanks in advance.
|
|
|
|
|
In a TabControl the functionality of the tabs themselves is very limited.
You have basically two choices:
1. create your own TabControl, giving you lots of headaches and full control.
2. modify the TabPage texts in accordance to the page being selected or not (that is what I would do). You could store the long and short texts in two separate Dictionary<TabPage,string> collections, and use the SelectedIndexChanged event to apply them.
|
|
|
|
|
Here's the way I would approach this: assuming this is WinForms: and, assuming that I wanted all the tabs to always maintain a certain short length
... of course Luc's excellent solution (above) would work great if you are willing to change the width of the TabPage Tab header text when each TabPage is selected ...
1. on the TabControl: set the 'ShowToolTips property to 'true
2. for each Tab:
a. define a short, hopefully mnemonic, name for the Tab
b. set the ToolTipText for that Tab to the longer name
3. fill each TabPage with a Panel with its 'Dock property set to 'Fill
Discussion: The Panel that fills each TabPage will not show a ToolTip, but mouse-over the Tab will show the "long name."
One step further using this suggestion: I suppose if I had a lot of Tabs ... or for future flexibility in revision/maintenance ... I might "automate" this by creating two matching Lists, or a Dictionary, and then, in the Form's 'Load EventHandler, doing the right thing to set each TabPage's 'Text and 'ToolTipText properties in a loop.
The Occam's Razor solution: Perhaps the simplest, idea of all, if you are willing to use the content area of the TabPage: put a label somewhere on each TabPage showing the full-name.
Thinking out-of-the-box: create a UserControl that joins a TabControl with a StatusStrip control, and show the full name, and whatever else, in the StatusStrip for each selected TabPage ?
"... Sturgeon's revelation. It came to him that Science Fiction is indeed ninety-percent crud, but that also—Eureka!—ninety-percent of everything is crud. All things—cars, books, cheeses, hairstyles, people and pins are, to the expert and discerning eye, crud, except for the acceptable tithe which we each happen to like." early 1950's quote from Venture Sci-Fi Magazine on the origin of Sturgeon's Law, by author Theodore Sturgeon: source Oxford English Dictionary on-line "Word-of-the-Day."
|
|
|
|
|
Hi All !
Is it possible to Naming "Row" of A DataGridView as a Column "Header Text" .
Thanks a Lot !
|
|
|
|
|
I'm not sure what you mean, but how about System.Windows.Forms.DataGridViewRowHeaderCell.Value ?
|
|
|
|