|
tosen_z wrote: But in C#, I could not found "Index" in Property of Label. What can I do, when I manage 400 Labels?
Use "Tag" property.
<br />
int index = 1;<br />
label1.Tag = index;<br />
....<br />
int val = -1;<br />
if (label1.Tag != null)<br />
val = (int) label1.Tag;<br />
<br />
<br />
Best regards, Alexey.
-- modified at 6:58 Monday 17th April, 2006
|
|
|
|
|
I don't find any property like tag in my Label
Which version of dotnet that U R Using?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
You're right. Only Framework 2.0.
In this case, you can identify them by location.
Or by name - concatenate some string to name, and then parse it.
Label[] labels = new Label[100];
for (int i = 0; i
|
|
|
|
|
Oh!Great to Hear tat U r Working on 2.0
I still did n't get an opportunity to work on it
Lucky U are!
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Thankyou!
But, if I have 400labels, to catch "OnMouseDown", do I must write 400funtions (each of labels has a funtion)? If not, I can group all and set event is "OnMouseDown", but how to know "label_1" but not is "label_2", when I click on one?
Thank for read!
III
|
|
|
|
|
You can get the index of label by this code on mouse down event
<br />
private void SplashForm_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
int index = int.Parse(((Label)sender).Name.Replace("Label_",string.Empty));<br />
}<br />
Your label names must be: Label_1, Label_2, Label_3 ....
But I think 400 labels isn't good decision.
Can you use some custom control instead ?
Best regards, Alexey.
|
|
|
|
|
Thank you verymuch!
I know, 400 labels isn't good decision, That make my Program slowly. But, I could found the other instead!
My project is a game that name "Caro". In that game, have 2 player, one use character "X", the other use "O", put on a "space game"( that is 400 labels, a matrix 20*20).
When I design 400labels, automatic, C# will create separately 400 labels. To overcome, I myseft write code in "InitializeComponent()" funtion is "System.Windows.Forms.Label[] myLabels=new System.Windows.Forms.Label[400]"... then it not visible in "Form1.cs [Design]" but haven't any error, and when I build it, and press "F5", in my window of "Form1", I can see immediate 400labels??????? I don't understand!
Thank for read!
III
|
|
|
|
|
I try to draw one pixel wide dashed lines in gdi+, but the result is very different from the one obtain with the gdi api functions. Te big problems are on diagonal lines or the lines which are not horizontal or vertical. If someone knows how to draw this lines in gdi+ with the same visual efect as in gdi please answer. I try with or without SmoothingMode, with or without PixelOffsetMode but the results are no better.
The best difference is on custm dotted lines with one pixel on - one pixel off
-- modified at 9:28 Thursday 20th April, 2006
|
|
|
|
|
Hello there
I have an image with Jpeg compression. When I try to load that file it gives me error "out of memory". Can any one guide me how to load the file ?
Image img;
img.FromFile("C:\\test\\1.tiff");
For Sample image with Jpeg Compression please download from the link below.
http://www.alm-soft.com/Rizwan/1.tiff[^]
I shall be very thankful to you for your kind support.
regards
Rizwan Bashir
-- modified at 5:15 Monday 17th April, 2006
|
|
|
|
|
Here's how you use the FromFile method:
Image img;<br />
img = Image.FromFile("C:\\test\\1.tiff");
---
b { font-weight: normal; }
|
|
|
|
|
Thanks but if you download the image file and run this code it will not work.
this image has jpeg compression you can load it in office document imaging but cannot in .net.
|
|
|
|
|
There is something wrong with the file. Some programs will open it, but Photoshop refuses to. How have you created the file?
---
b { font-weight: normal; }
|
|
|
|
|
this is a tiff file compressed with jpeg algorithm.
when I scan the image my scanner returns me this format image
-- modified at 7:35 Monday 17th April, 2006
|
|
|
|
|
This happens because GDI+ doesn't fully support JPEG compression in TIFF files. You'll have to either use an uncompressed version of the file or one compressed using LZW.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I found that very few programs open this file. Further exploration found that it uses a largely obsolete form of JPG compression. Check if there is a new driver for your scanner. You could also try using IrfanView (a free program) to batch convert your scans.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
i am trying to write a c# program communicating to a device (PLC) using socket. the communication is in hexadecimal. everything are alright - socket connection, socket send and received etc. i had created a byte array for the socket's send.
for example, 2 bytes are use to send a decimal value of 100. this is fine.
byte[1] = 0x00;
byte[2] = 0x64; // 64 hex = 100 dec
however, i am having problem to send a decimal value of more than 255. for example, to send a decimal value of 300,
byte[1] = 0x01;
byte[2] = 0x2C; // 12C hex = 300 dec
if i read back form the bytes array, instead of getting the decimal value of 300, it's becomes 144 - byte[1] = 1 and byte[2] = 44.
i am not quite sure if i should use byte array to store the hex value since it will be converted to hex decimal value separately. i had tried to use string array but enventually i still need to convert to byte array in order for the socket to send out. the smae
i am looking forward for your advise. thanks indeed.
Regards,
CC Pang
Software Engineer
|
|
|
|
|
The device probably needs a signed byte, so try that
|
|
|
|
|
johnly wrote: if i read back form the bytes array, instead of getting the decimal value of 300, it's becomes 144 - byte[1] = 1 and byte[2] = 44.
That's exactly what you put in the array, you are only adding the values wrong.
256 * 1 + 44 = 300
---
b { font-weight: normal; }
|
|
|
|
|
I want to generate dll in C# for stringConnection by using exception handling concepts.First I have to check whether the database exist or not,if the database exist then ok otherwise error message should be displayed "Database does not exist" ,if the table is there in the database if the record is there in the table otherwise "eror message" should be fired.
Binu Koshy
|
|
|
|
|
Do you have any specific problem with this task or do you expect us to give you complete code.?
www.troschuetz.de
|
|
|
|
|
completed code
Binu Koshy
|
|
|
|
|
In this case you will not have much luck here. Nobody will do your work in his spare time.
Ask some specific question and we'll be glad to help.
www.troschuetz.de
|
|
|
|
|
binukoshy wrote: completed code
Uhmmm, do you call yourself a developer? With all due respect, I suppose you are working for one of the Indian companies that is robbing Americans of jobs. Figure it out yourself and then ask questions if you run into problems. That is what REAL developers do.
|
|
|
|
|
in net2003 codes have:
MSDASC.DataLinks mydlg = new MSDASC.DataLinks();
OleDbConnection OleCon = new OleDbConnection();
ADODB._Connection ADOcon;
//Cast the generic object that PromptNew returns to an ADODB._Connection.
ADOcon = (ADODB._Connection)mydlg.PromptNew();
OleCon.ConnectionString = ADOcon.ConnectionString;
OleCon.Open();
if (OleCon.State.ToString() == "Open")
{
MessageBox.Show("Connection Opened");
OleCon.Close();
}
else
{
MessageBox.Show("Connection Failed");
}
but in 2005 new format has,example ".net Framework ole db ".but the old dialog in 2003 can not show it.
2005's new dialog can show by writing codes ???
i come from china,English not well,sorry~
mymail:mikebai604@hotmail.com
mikebai
|
|
|
|
|
anyone can help me??thanks...
-- modified at 23:46 Monday 17th April, 2006
|
|
|
|