|
THANK YOU ALL!!!
It works! Now I can keep on working on this! Thanks!
The program's homepage: http://www.BeepXtreme.tk
Darth_Sulfur (Sulfurik)
http://www.sulfurmidis.com
http://www.sulfursoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|
Dear All,
I have the following issue...
I need to call a function from an unmanaged dll...
One of its input parameters is described as follows;
CvContourRetrievalMode as the datatype name
and it takes one of four values{CV_RETR_TREE...etc}
so shall I define it as enum or what?in msdn I found only examples for strings,structs and classes?any suggestions?
Thanks and Best Regards,
E.A.
|
|
|
|
|
|
|
hi, i use a Text Box...can i underline some text in the text box?
For example when i have:
Hello how are you?
i want to underline Hello and you...
maybe its possible...
cu
|
|
|
|
|
|
As above message suggested use richtextBox
if you select some text by mouse or keyboard
you can write somthing like
private void button2_Click(object sender, System.EventArgs e)
{
richTextBox1.SelectionFont=new Font(richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style ^ FontStyle.Underline);
}
Note:
Use ^ Operator Not | Operator this will allow you doing the reverse
if th selected text already underlined it will remove underline style
you can select text programatically by using
richTextBox1.Select Or richTextBox1.SelectAll
MCAD
-- modified at 20:02 Saturday 27th August, 2005
|
|
|
|
|
hi, ok i will try this, but when i dont want to use select...
any idea how only to underline one word in the richtextbox?
cu
|
|
|
|
|
surfman19 wrote:
i dont want to use select
Why you don't use Select?
Select tell richtextbox which text it will be formmated
by given style
surfman19 wrote:
how only to underline one word in the richtextbox
can you give example if you want to underline hello
for example you need to search for it and select it
and change underline style
MCAD
|
|
|
|
|
i thought the user must select, but if i can do that automatically its ok!
i will try it...
cu
|
|
|
|
|
What you do is you get the current selection and save it, then select the word you want to format, change the formatting, and restore the original selection. The user won't notice at all.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
If you want to select Hello word and change underline
programatically you can write some thing like
int pos=richTextBox1.Text.IndexOf("Hello");
if(pos != -1)
{
richTextBox1.Select(pos,"Hello".Length);
richTextBox1.SelectionFont=new Font (richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style ^ FontStyle.Underline);
}
if you want to select all Hello words in string and change its style modefiy the code and use loop
MCAD
-- modified at 8:16 Sunday 28th August, 2005
|
|
|
|
|
hi,
how can i pass a parameter to a thread function? maybe a little sample is not so bad...
cu
|
|
|
|
|
You can Create your thread function in class and pass
The Parameters to the class Constructor
For Example
<code>
public class Test
{
private string firstName;
private string Lastname;
private string fullName;
public Test(string fn,string ln)
{
firstName=fn;
Lastname=ln;
}
public string FullNameProp
{
get
{
return fullName;
}
}
public void FullName()
{
fullName=firstName + " " + lastName;
}
}
</code>
Then create instance from this class and path FullName Method to ThreadStart
you can access FullNameProp to get the result value
another method you can use Asynchronous Calls
Note:
this code i typed it here directly so review it
MCAD
-- modified at 18:29 Saturday 27th August, 2005
|
|
|
|
|
hi, thx a lot!
can i start the threat like that?
<br />
Thread worker = new Thread(new ThreadStart(FullName));
worker.Start();
why is public void FullName(), fullName, fistName and lastName not static?
cu
|
|
|
|
|
hi now i understood what you mean
here my code...any improvements?
<br />
using System;<br />
using System.Threading;<br />
<br />
namespace MyConsoleThread<br />
{<br />
class ThreadMain<br />
{<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
MyThread thread1 = new MyThread();<br />
Thread[] ta = new Thread[100];
<br />
for (int j = 0; j<10; j++)<br />
{<br />
ta[j] = new Thread(new ThreadStart(thread1.start));
ta[j].Start();
}<br />
<br />
System.Console.ReadLine();<br />
}<br />
}<br />
<br />
class MyThread<br />
{<br />
public int i=0;<br />
public Object lockvar = "";
<br />
<br />
public void start()<br />
{<br />
Monitor.Enter(lockvar);<br />
String mystring = "Thread gestartet ";<br />
i++;<br />
mystring += i;<br />
System.Console.WriteLine(mystring);<br />
Monitor.Exit(lockvar);<br />
}<br />
}<br />
}<br />
|
|
|
|
|
While your code is okay, having a Monitor protect the start function will force each thread to wait until the thread that acquired the Monitor releases it. Which makes running start in a 100 different threads totally useless. You might as well run it in a loop, like
for(int i = 0; i<100; ++i) thread1.start();
The only difference is that, with threads, there is no guarantee as to the order in which each of the 100 threads execute.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Dear ALL,
I want to call an opencv function from C#...(a function from the OpenCV library provided by Intel)
I was wondering if I just call the .dll or is there some sort of installation that has to be done to the library?
Best Regards,
E.A.
|
|
|
|
|
|
Thanks Muhammad,
I have read about P/Invoke...
My problem now is with marshalling the data between the managed and unmanaged code...
The unmanaged function that I want to call has the following input parameter of type CvContourRetrievalMode that takes only 4 values ,either CV_RETR_TREE ..etc
I don't know if it would be correct to use an enum in this case?
Thanks again,
E.A.
|
|
|
|
|
Hi
I'me new to C# and about to finish my first example program. It is a command line program (no gui). What I want to do now is adding a form for configuration values. These values should be written into an xml file and should be read by the program afterwards.
I heard about system.configuration and its read capabilities. But I didn't heard anything about writing to sections.
Now my question: Where can I get tutorials or other informations about writing and reading to/from configuration files?
Thanks and regards Fredy
|
|
|
|
|
|
Thanks alot! This helps.
Have a nice weekend! ;)
|
|
|
|
|
Hi,
I want to encrypt a password and store the encrypted version in the database. then when the user logs in, I want to decrypt the user password and match with the entered password. I read about DESCryptoServiceProvider, but still i am not able to understand it. Can someone send a link of article which is easy to understand/provide a piece of code here. It would be great for me.
Thanks
|
|
|
|
|
Hi,
If you want to store a password in database, I suggest you use a 'One-Way Hash' algorythm.
These are un-reversable encryption algorythms, hence the name one-way. Then you follow these steps to authenticate your users:
1. User Registers, Username and Hashed Password are stored in DB.
2. User types in Username and Password. P = password
3. The Software encrypts the Users Password with a One-Way Hash. P1 = Hash(P)
4. The Software queries the database and finds the password of the user (Storing Hashed in the database). P2 = database_pass
5. If the Hashed Pass in the DB and Hashed Pass the user typed in Match, Allow Login. If P1 == P2 then Login else Fail (remeber P1 = Hash(P))
Try this code to generate a one-way hash of a password.
-------------------------------------------------------------------------------
private Byte[] GetByteArray( String originalString )
{
Char[] charArray = originalString.ToCharArray();
Byte[] byteArray = new Byte[charArray.Length];
for ( int i=0; i<byteArray.Length; i++ )
{
byteArray[i] = Convert.ToByte( charArray[ i ] );
}
return byteArray;
}
/// <summary>
/// Creates a one-way SHA1 hash of the pt string
/// </summary>
/// <param name="pt">Plaintext to Hash</param>
/// <returns>Ciphertext string</returns>
public string Hash(string pt)
{
//Implement SHA1 Hashing Algorythm (40 Bytes / 320 bits)
byte[] data = new byte[40];
byte[] hash = new byte[40];
while (pt.Length % 4 != 0) pt += "g";
data = Convert.FromBase64String(pt);
SHA1 sha = new SHA1CryptoServiceProvider();
hash = sha.ComputeHash(data);
return Convert.ToBase64String(hash);
}
-------------------------------------------------------------------------------
Thanx!
Dave Shaw
History admires the wise, but elevates the brave. - Edmund Morris
|
|
|
|