|
yes there is a way to use a dynamical array: the class
ArrayList (I guess in System.Collections )...it automatically resizes when necessary, and thus it has no fixed length as a "normal" array in C#....but ArrayList stores the assigned values as objects (aka boxing), so you have to cast when you return something from the ArrayList....
for example:
int i = 5;
ArrayList al = new ArrayList();
al.Add(i);
int storedInt = (int) al[0]; //unboxing
|
|
|
|
|
|
Note that boxing and unboxing is only done when casting value types from an object reference. Casting a reference object does not box or unbox, it simple performs a cast.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
anybody knows about that? please give me one basic example how to use API in C#
nam
|
|
|
|
|
Try this article[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event[^].
|
|
|
|
|
thanks Colin Angus Mackay alot
nam
|
|
|
|
|
|
well, it's easy to understand for the beginner, thanks Jay_sh_s alot
nam
|
|
|
|
|
Hi All,
I want to disable text resize of texts of a rich text box when Ctrl + Mouse Wheel scroll is being proformed.
Any idea!! Any clues!! How to fix it.
Please suggest...
Thanks in advance,
Regards,
Jay.
|
|
|
|
|
Extend the RichTextBox class and override WndProc . If you don't want to allow zooming at all, catch the EM_SETZOOM (0x04e1) and don't call base.WndProc . If you don't want the mouse to be able to set the zoom factor, then catch the WM_MOUSEWHEEL (0x020a) and use the static Control.ModiferKeys properties to easily determine if the Ctrl+MouseWheel is in effect. If it is, again, don't call base.WndProc . In all other cases, be sure to call base.WndProc passing a reference to the Message struct otherwise your control will not work at all and may not even be initialized correctly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
Thanx a lot, I could solve the problem by
1.Extending the RichTextBox class
2. Catching WM_MOUSEWHEEL (0x020a) and
checking whether Control.ModiferKeys is Keys.Control
3. not calling base.WndProc in the above case (mentioned in 2).
Where as I could not get the result by Catching EM_SETZOOM (0x04e1) and not calling base.WndProc.
I am keen to know whether is it possible to solve the problem using EM_SETZOOM ?
Please Comment.
Thanks and Regards,
Jay.
|
|
|
|
|
RichTextBox.ZoomFactor is also between 0.64 and 64.0 because it simply uses the EM_GETZOOM and EM_SETZOOM message which it sends to the underlying window handle, same as practically all the controls in Windows Forms.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
Thanks for the info. using EM_SETZOOM should give the same result.But it does not work
I tried to catch the EM_SETZOOM using the following code
Did I go wrong somewhere in implementation?. Please comment.
protected override void WndProc(ref System.Windows.Forms.Message m)<br />
{<br />
<br />
if (m.Msg == 0x04e1)
{<br />
return;<br />
<br />
}<br />
else<br />
{<br />
base.WndProc(ref m);<br />
<br />
}<br />
<br />
}
Where as catching WM_MOUSEWHEEL and asserting Control.ModifierKeys == Keys.Control solves the problem.
Thanks and Regards,
Jay.
|
|
|
|
|
I've tried a few things to and it's my educated guess that the Rich Edit control (which is encapsulated by the RichTextBox ) doesn't use the EM_SETZOOM when using Ctrl + Mouse Wheel and instead handles that internally in much the same way the handler for EM_SETZOOM does.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
Thanks a lot for sparing your valuable time to solve the problem.
Warm Regards,
Jay.
|
|
|
|
|
"How to develop a screen saver in C# By Rakesh Rajan" is the template I've been using to for multiple monitor support, but when i try to implement it into my code only one monitor pops up with screensaver and when i do either mouse event or keyboard event that monitors screensaver kills and then the other monitor pops up with screensaver. I'm guessing that it won't load next screens form until current form is termated. Here is the code...
for(int i=Screen.AllScreens.GetLowerBound(0);
i<=Screen.AllScreens.GetUpperBound(0); i++)
Application.Run(new ScreenSaverForm(i));
Do i use a thread or something.. been workin on this last part of project for a while now.. any suggestions
FYI.. I'm not rich. My desktops motherboard died and i just plugged monitor into back of laptop.
Codemonkey
pgf_codemonkey@hotmail.com
|
|
|
|
|
Application.Run is a blocking call that starts the message pump and wants until the main form is closed. Since this is in a loop, when the main form is close then the next iteration of your loop executes.
You should instead design your form to span multiple monitors (see SystemInformation.VirtualScreen ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
How would you push applications to a specific monitor and not just stretch the screen space?
This sounds interesting for a project I'm doing.
Regards,
Eric C. Tomlinson
Silence is golden, so shut the heck up!
|
|
|
|
|
You can use the Screen class. See Screen.AllScreens , which is a static property that returns a Screen[] array.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the great hint. I appreciate it.
Regards,
Eric C. Tomlinson
|
|
|
|
|
Hi,
I got a question like this:
Q : You create an assembly by using Visual Studio.Net. The assembly is responsible for writing and reading order entry information to and from an XML data file. The assembly also writes and reads values from the Windows registry while it is being comsumed.
The assembly will be distributed to client comoputers by using your company intranet. All client computers are configured to implement the default .NET security policy.
You need to implement security in the assembly. What should you do?
a. implement declarative security and execute the permission demand to allow access to the file system and windows registry.
b. implement declarative security and execute the minimum permission request to allow access to the file system and windows registry.
c. implement imperative security and execute the permission demand to allow access to the file system and windows registry.
d. implement imperative security and execute the minimum permission request to allow access to the file system and windows registry.
Which one is correct? and Why?
Thanks a lot!!
|
|
|
|
|
alanshen209 wrote:
Which one is correct
b
alanshen209 wrote:
Why?
Declarative has bettter performance than imperative and it didn't want any custom security so we use this one. I think we have to use minimu permission cause it has to be used through intranet, so it need to use tighter security.
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
Hello there
My friends and I are going to make an PocketPC application with c#. But at the moment we do not know if we will need an device for testing pusposes.
We figured out that there is an emulator "shipped" with the sdk but is this emulator enough for testing pusposes?
Our application will have an server / client architecture were the pocket pc is the client and receives / send information via LAN.
At the moment this is a new expierence for us because we have never made an working c# / pocketpc application. we are used to java programming from school therefor the change to c# wasn't that hard , but we don't know the details from c# about pocketpc application development.
i hope i have hit the right forum for my question.
thanks in advance
|
|
|
|
|
If you installed VS.NET 2003 with the default options, you already have the Smart Device Extensions and an Emulator. You can also get the emulator from the Windows Mobile for PocketPC 2003 SDK (there's ones for PocketPC 2002 as well, though that NetCF is beta and will never be released).
The emulator is just that - it emulates the hardware and has an actual PocketPC image installed on top of it. So long as the OEM didn't rebuild it with missing critical system packages, you should be fine. Note, then, that it's not really the OS that's being emulated, it's the hardware with the OS installed.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i just recogniced that i have only visual studio.net , at the moment i am using the school licensed version... i'll get my professional 2003 in the next weeks.
But if you say it's all included with vs.net 2003 than our problems are solved and we are able to save a lot of money
thanks for your fast answer.
|
|
|
|