|
now it is getting bigger when i switch between design view and code view it is very slow any ideas on how to spped it up
|
|
|
|
|
are you placing any background image to your window?
I usually disable it.
|
|
|
|
|
|
Hi,
I'm writing a program that performs CRC check on sfv files, I've got a method creating an array that's used for filling a listview item, the array is
<br />
public struct LineToCheck<br />
{<br />
public string fileName;<br />
public ulong CRC;<br />
public LineToCheck(string filename,ulong CRC,)<br />
{<br />
this.fileName=filename;<br />
this.CRC=CRC;<br />
}<br />
};
I added a button in my form to start sfv check but since the array is created in a method, I had to create a public static LineToCheck array as global variable and to use .ToCopy(global_array) to fill it, but doing so I've to fix a lenght of array, if I were in C, I would have used LineToCheck *array, and I would have dinamicly add elements.... is there a way to do so in C#??? or to trim an array at inside's method array's lenght?
I don't know if I've been clear..... I hope so, thanks
Paolo
|
|
|
|
|
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!!
|
|
|
|