|
Hi,
I have a class where i'm creating a ButtonArray. Once i have created some elements in this array i want to access each of them in order to move them around in a panel. However i can't seem to get the information from the Move() funtion to be used in the MouseUpHandler which is the one handling the release of a button press (dropping the button at a new location).
Could anyone please help me out here, and please do say if you need more code than i have provided.
public void MouseUpHandler(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.Move((System.Windows.Forms.Button) sender).Tag), host, _iXCoorRelative, _iYCoorRelative);
}
public void Move(object sender, System.Windows.Forms.Control host, int _iXCoorRelative, int _iYCoorRelative)
{
ButtonArray btnArray = new ButtonArray(host);
btnArray[Convert.ToInt32(((System.Windows.Forms.Button) sender).Tag)].Location = new System.Drawing.Point (_iXCoorRelative, _iYCoorRelative);
}
|
|
|
|
|
Why does it "seem" like you can't get the information? What happens?
Where do you declare the host, _iXCoorRelative and _iYCoorRelaive variables, and where do you specify the values for them?
You send the contents of the Tag object of the button as sender to the Move method, then you reference the contents as a Button object. Do you really store a reference to a button in the Tag object of the button?
---
b { font-weight: normal; }
|
|
|
|
|
How it is possible to load and read .gif, .jpg, .bmp, .png, .mpeg and other files can i open and read in my application divx files?
Is there a free loader dll or similar?
|
|
|
|
|
how to create the COM and COM+ Program in c#
m mohamad rafi
|
|
|
|
|
You Can Create COM+ Application in .Net By Create your dll
and inherit your class from ServicedComponent
and assign Your assembly and each of its classes with distinct GUID values by using the Guid attribute if you don't give it guide value it in the following assembly registeration will assign one for each element But as you now Com+ undersatnd COM not .Net Component so to let other COM Client Find and Use your component you need to register your .Net Component as COM Server in Windows Registry This process called Asssembly Registration
1-sign a .NET assembly using the Strong Name tool (sn.exe).
2-Register your assembly You can do it by more than one way for example in your Project Properties change Register for COM Interop option to true or Use the Assembly Registration tool regasm.exe
for more info look at
Creating COM+ Objects using EnterpriseServices in .NET
[^]
COM/COM+[^]
ServicedComponent Class[^]
To Export your Component As COM Type Libraries You Can use the tools mentioned above but notice that you don not have to inhiret from ServicedComponent ie
1-Create Your Component
2-Export it as Type Lib By Using one of the following tools
*-In Project Properties Set Register for COM Interop option to true
*- Use the Assembly Registration tool (regasm.exe ) with its /tlb option
*-Use the Type Library Exporter tool (tlbexp.exe )
MCAD
-- modified at 14:52 Thursday 29th September, 2005
|
|
|
|
|
Hi All
I want to create an application that is connect to a mobile phone and retrieve some info from it like SMSs , MMSs,etc....
How can I extablish a connection to the phone and start retrieving data;
Thanks
|
|
|
|
|
hi
i have started one thread. it has read four lines. After that i want to wait that thread so that second thread so that execute.
HOw can i wait a particular thread.
i do not to use Thread.sleep(500); it stops all the thread.
I want to wait that thread for some time or tilll other threads completed its job.
thanks
|
|
|
|
|
Thread.Sleep will only cause the thread on which you called it to sleep, it won't affect other threads. If you have specific places in code where you want to wait/notify, you can use the AutoResetEvent[^] class. Something like
class Test
{
AutoResetEvent evt = new AutoResetEvent(false);
void Thread1()
{
evt.WaitOne();
}
void Thread2()
{
evt.Set();
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi all,
I have an exe which i want to register as windows service programatically in a C# project. This exe is in a folder on the system.
Any help on this........
Lata Agrawal
|
|
|
|
|
have you tried srvany.exe
i think it's available from MS or on the resource kits
If you actually want to modify the source code for your exe, there are a few articles on the web that deal with this, there are problems with debugging a service though, although work arounds are available.
Russ
|
|
|
|
|
hi,when we speek in Microphone (during chatting)some binary data is stored in the RAM.can any one tell me the way through which i can access those bytes. i will be very thankful to u.
|
|
|
|
|
i have an mdi form containing a child form. When a button is clicked, a child form is shown. When the same button is clicked again, a new instance of the same form then appears again --> 2 of the same form appear at the same time. Is there any way that i can check for the child form's existence and show it if an instance of its is already generated?
Thank you so much.
KiT
-- modified at 8:53 Thursday 29th September, 2005
By the way, here's my code:
private frmMcStock mcStock;
private void tscmdMcStock_Click(object sender, EventArgs e)
{
if (mcStock == null)
{
mcStock = new frmMcStock();
mcStock.MdiParent = this;
mcStock.Show();
}
else
{
mcStock.Focus();
}
}
-- modified at 9:03 Thursday 29th September, 2005
|
|
|
|
|
You can simply have a class member variable where you store the instance of the child form. Next time you click the button, check if the variable is null. Something like
class MainForm
{
Form childForm;
public void CreateForm()
{
if (childForm == null)
childForm = new ChildForm();
else
childForm.Focus();
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
OH... How could i forget about .Focus() Must be 'cuz of the flu. I kept trying to use .Show() instead and nothing happened. Thank you so much...
KiT
-- modified at 8:49 Thursday 29th September, 2005
Another problem occured. When i close the opened child form, i cannot re-open it by clicking the same button. It seems like the child form is not disposed. Here's my code:
private frmMcStock mcStock;
private void tscmdMcStock_Click(object sender, EventArgs e)
{
if (mcStock == null)
{
mcStock = new frmMcStock();
mcStock.MdiParent = this;
mcStock.Show();
}
else
{
mcStock.Focus();
}
}
|
|
|
|
|
Hi
I need to convert a ushort[] to byte[].
if this was C I wouldn't be asking but I wonder how to do this most efficient (new array + for) in C#
Gilad.
Ofcource the other way around is a must...
|
|
|
|
|
Try the Array.Copy method:
byte[] newArray = new byte[original.Length];
Array.Copy(original, newArray, original.Length);
---
b { font-weight: normal; }
|
|
|
|
|
|
In what way didn't I read the question correctly?
I tried it, and the result is that it can't be copied that way. The probable reason is that you might lose data as an ushort can not safely be converted to a byte.
Copying a byte array to a ushort array works fine, though.
You have to loop through the array yourself and convert each value, and handle possible data loss in the conversion. One way is to simply use the lower eight bits of the value and discard the higher eight bits.
---
b { font-weight: normal; }
|
|
|
|
|
|
I guess this is the only way...
If I have an array of ushort[] and I want to "cast" (not copy) it into an array of byte[] then how do I do this:
ushort[] A = new ushort[10]
byte[] B;
unsafe{
fixed(A){
// ??? //
}
}
now I would like to access the first byte of the first (MSB) ushort in the array through B. what do i need to do after the "fixed" statment ?
thanks.
Gilad.
|
|
|
|
|
Anonymous wrote:
I want to "cast" (not copy) it into an array of byte[]
Just like C, you cant cast to a "fixedsized" array. So you either have ushort[] and go to byte* or have byte[] and go to ushort*. Two array references cannot manage an array differently.
ushort[] A = new ushort[10];
unsafe{
fixed(ushort* a = A){
byte* b = (byte*) a;
for (int i = 0; i < A.Length*2; i++)
{
process(b[i]);
}
}}
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
Hi,
I just found (and disapointed a bit) that after developing a huge app i used "Lutz Roeder's Reflector" to watch my app hierarchy just for fun and realised that all the source code was in the Disassembler panel, just the way i writed it, including private methods, i mean all!. Hey! What if my app is commercial software? then i'm giving it for free (the whole source code included).
Is there a way to protect my code from being watch, crack or reverse engineered? I'm kind of lost.
Thanx a LOT!
|
|
|
|
|
C# applications have this problem of transparent code. You can try using an Obfuscator (one is supplied with Visual Studio itself) but it will solve the problem only partially. As of today, there does not appear to be a perfect solution for this problem. While you can make it more difficult for others to see your code or to reverse engineer it, but unfortuately there does not appear to be a perfect solution which could stop it absolutely.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|
|
Whow! It seems like a huge bug in the C# specification.
1) Whose this bug: C# or .NET Framework?
2) Does this happens in VB. NET?
3) Does this happens in C++ (native, not .NET)
4) Is C# 2.0 going to solve this issue?
Thanx for your comment Ashok.
I've got a lot of .NET commercial apps, i'll rip and steal lots of hard to write code....hehehe, no just kiding, i could but i wont. I disagree with ilegal stuff, that's why i posted this thread.
Anyone else has something to say about this issue?
|
|
|
|
|
Heinz Suez wrote:
Whow! It seems like a huge bug in the C# specification.
It is not a bug but a deliberate design because the .NET applications are not compiled to native code but to the intermediate language code (called MSIL). This MSIL code is then compiled to the native code at the time when the user runs the program by using what is known as Just-in-time compilation. It is this MSIL code which is converted by "Lutz Roeder's Reflector" or ILDASM (supplied with Visual Studio) to show legible code.
Heinz Suez wrote:
1) Whose this bug: C# or .NET Framework?
2) Does this happens in VB. NET?
This problem is with .NET framework, so the code written in VB .NET can also be seen in a similar manner.
Heinz Suez wrote:
3) Does this happens in C++ (native, not .NET)
No, it does not happen in C++ native code. But, C++ .NET will have the same problem.
Heinz Suez wrote:
4) Is C# 2.0 going to solve this issue?
In the Beta version available for C# 2.0 as of today, this problem exists. One does not know about the final C# 2.0 product but the chances are that this problem is not being solved even in that.
Hope it answers your question.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|