|
It was clear enough to anyone who already knows what what you mean.
|
|
|
|
|
Structs are value types - what that means in your situation is that it should only be used to represent a value.
For example an int has one particular value lets say 1. If you need an int with the value of 2 then it must be a different int as there is no way that 1 can be 2. Therefore, once a value is set for a struct it should not be changed by a property, method or anything else. This is called immutability and something all structs should adhere to (although there are exeptions in the framework). So all properties will be readonly and any methods that normally mutate the object should return a new instance of the struct with the required values and leave the original instance intact.
Also, the fields that make up a struct (must be private) should be value types themselves and should not, when combined, have a large memory footprint.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Keep it simple; don't use structs.
|
|
|
|
|
How Can i change some Controls Size at runtime like .Net?
I mean :
I wanna users change the size of controls by clicking on control and then change the size like when designing the form !
|
|
|
|
|
Try this[^]. So many hits!
..Go Green..
|
|
|
|
|
|
I didn't get you. I guess, the link that I gave you lists so many articles explaining what you asked.
..Go Green..
|
|
|
|
|
I know google.
First i search google then if no good and then Codeproject.com
|
|
|
|
|
Not so easy, a few steps are involved. You need some event for deciding to change to your "edit" mode, e.g. a right mouse click on the control. Then, draw a rectangle around it or mark it otherwise. When you receive a mouse button down event on the border of that marked control, set a flag. Then observe the mouse move events and resize your control. When the mouse button is released, remove your flag. You may need to call Refresh() time and again for getting the things drawn nicely.
|
|
|
|
|
Thanks!
but i didnt understand
May u plz give me an example for this.
I need this code for my project!
PEASE HELP
|
|
|
|
|
This may help u
private void button1_Click(object sender, EventArgs e)
{
button1.Size = (new Size(50, 100));
}
Cheers
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
NO ..
Not Like This
I want something like the previous solution !
But Dont know how to do that ?
|
|
|
|
|
I think U have to maintain a configuration file with control default properties.,
when u need the default properties (old properties), read & set the properties from configuration file.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
The Solution of bhiller is best .But i cant do that .
PLZ help !
|
|
|
|
|
Okay, I think I got your question now.
Try this: Allow the User to Resize Controls at Runtime[^]. The code is in VB. But once you understand the concept you can write your own code to do that or you may convert it using the conversion tools available online.
Let me know if this is what you wanted.
And ya, I found the link using Google.
..Go Green..
|
|
|
|
|
Hi,
I draw a rectangle over some text using solid brush. The content is invisible after drawing that rectangle. Is there any other brush which gives the transparency.
|
|
|
|
|
See here[^] for some samples on using the Opacity property.
It's time for a new signature.
|
|
|
|
|
Hi Experts,
I am trying to convert a VB application to C# .net. I came across an enum which contained values as
stsAvailabilityBits = &HF,<br />
stsFormAccessAllowed = &H1,<br />
stsValidUser = &H2,<br />
stsSystemAvailable = &H4,<br />
stsPermissionGranted = &H8,<br />
stsInquiryOnlyBits = &HF0,<br />
stsFormInquiryOnly = &H10,<br />
stsUserInquiryOnly = &H20,<br />
stsSystemInquiryOnly = &H40,<br />
stsRecordLocked = &H80,<br />
stsShutdownMinutesBase = &H100,<br />
stsShutdownMinutes = &HF00,<br />
stsErrorReturned = &H1000,<br />
stsFatalError = &H2000,<br />
stsTableEmpty = &H4000,<br />
stsResultsReturned = &H8000,<br />
stsParentControl = &H10000,<br />
stsLoadResultset = &H20000,<br />
stsSpecialPrivBitsReturned = &H40000,<br />
stsRecordAccessReturned = &H80000,<br />
stsTableLockRequested = &H100000,<br />
stsTableLockConflict = &H200000,<br />
stsMultipleLockConflict = &H400000,<br />
stsAvailBit23 = &H800000,<br />
stsUserCanExport = &H1000000,<br />
stsUserCanRename = &H2000000,<br />
stsUserCanReport = &H4000000,<br />
stsUserCanDelete = &H8000000,<br />
stsGetForInquiry = &H10000000,<br />
stsWebUser = &H20000000,<br />
stsAvailBit30 = &H40000000,<br />
stsAvailBit31 = &H80000000<br />
I am not able to understand what are these. I think they are hexadecimal values. If they are then how can i convert them into decimal/integer values in C#.net?
Please help!
Thanks!
Regards,
Samar
|
|
|
|
|
try this code...
private string getDecodedKey(string strKey)
{
string strTemp = string.Empty;
string[] strSplitKey = strKey.Split(' ');
foreach (string strHex in strSplitKey)
{
try
{
int intVal = Convert.ToInt32(strHex, 16);
strTemp = strTemp + Char.ConvertFromUtf32(intVal);
}
catch
{
strTemp = strTemp + strHex + "GET DECODED KEY";
}
}
return strTemp;
}
|
|
|
|
|
Hi Ice,
I tried running your code with the value of strKey as "&HF" and it showed me the error
"Could not find any recognizable digits."
on this line of code
int intVal = Convert.ToInt32(strHex, 16); .
Am i doing anything wrong here?
Regards,
Samar
|
|
|
|
|
Hi Ice,
Your code was good except that i need to pass 0xF instead of &HF i.e. replacing &H with 0x.
Also i am not getting the proper value when i use the following code but when i comment the same then it was working fine.
strTemp = strTemp + Char.ConvertFromUtf32(intVal);
Can you please let me know why were you using the above lines of code??
Regards,
Samar
|
|
|
|
|
Hexadecimal, Decimal, Binary etc are representations, they're always good values.
Replace "&H" by "0x".
Cheers
I don't like my signature at all
|
|
|
|
|
Hi Estys,
Estys wrote: Replace "&H" by "0x".
What am i suppose to do after replacing? Because even after replacing it wont be an integer or float or decimal, right?? Am i suppose to try and convert into an int or something after that??
Regards,
Samar
|
|
|
|
|
(vb) &HFF = (c#) 0xFF = 255
The values are the same, it's just another way of representation.
The only thing that matters is the type of the variable.
So int myint = 0xFF; is perfectly legal.
The following lines are equivalent integer declaration / assigments:
int sixteen = 16;
int sixteen = 0x10;
This is a float :
float onetwethreefourfive = 123.45f;
So you don't need to convert the value, just replace the hex-prefix from &H to 0x.
In your case, some of the values cannot be assigned to int but must be assigned to uint or long , for instance 0x80000000 .
I don't like my signature at all
modified on Tuesday, April 27, 2010 5:28 AM
|
|
|
|
|
Hey Estys,
I got it! Thanks a lot! Just one more question.
I have a textbox in which I am entering the data like "0xF". On click of a button i want to display its integer value. When i try the following code
Convert.ToInt32(txtHex.Text);
It is showing me "string not in correct format.".
What am i missing here?
Regards,
Samar
|
|
|
|