|
Hi
I have various forms that are opened by a main form (SDI) and each form has its own context menu (for right clicking) that includes functions like copy, paste, delete, etc. But if I select Edit->Copy from the main menu of the main form, it should copy the right thing in the currently active form (the form with the focus) . What is the best way to accomplish this basic function? Is it through menu merge?
Thanx
|
|
|
|
|
Are you talking about MDI. If its a MDI, then Menu merge will work. Have the implementation of the menu clicks on the child form.
The parent window should provide the basic menu's like Exit, Open, Close arrange vertically etc.
|
|
|
|
|
i'm actually working with SDI, is there a way to merge it in SDI?
|
|
|
|
|
u should put the data to be copied in the active form in the somthing liake a clipboard (ie: an object) and pass this object to the main form
|
|
|
|
|
When you use File.CreateText and then pass a normal string to the resulting StreamWriter's Write method, does it automatically convert the text to UTF-8, or do I need to encode it first?
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Strings in .NET are an abstract concept, they do not have any encoding but are just unicode (in their internal memory representation, they use UTF-16, but you'll never notice until you use unsafe pointers).
Encoding is always done when converting from String to bytes, so yes, the StreamWriter does this for you.
|
|
|
|
|
That's what I thought, but for some reason when I save out my file, it does not seem to be UTF-8 encoded. I know this because when you open a text file in notepad and then select File | Save As..., you will see in the "Encoding" combo box of the Save As dialog, the encoding of the current document. In this case it came up as ASCII. To test this, I saved the file out as the same file name using the UTF-8 encoding with notepad and then closed it and loaded it back into notepad again--once again selecting "Save As..." to see what the Encoding drop down defaults to. It came up as UTF-8 the second time.
Is it really writing it out as UTF-8? Any ides?
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
It is writing a UTF-8 stream without any header. Unless you have multi-byte characters, you can't tell the difference between a UTF-8 document and a normal ASCII document.
To include the preamble header call: StreamWriter(fileName, System.Text.Encoding.UTF8);
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Suuuhweeet! Thanks. That's what I was looking for.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi...
I have created a normal color dialig like this:
ColorDialog cd = new ColorDialog();
cd.Color = Color.Black;
Color NewColor = Color.Empty;
if(cd.ShowDialog() == DialogResult.OK)
NewColor = cd.Color;
It works great, but my problem is, that i only wants
the SystemColors to be shown in the ColorDialog,
so the NewColor only can be a System Color.
Can anyone help me?
Thanks
QzRz
|
|
|
|
|
Try this,
ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = false;
colorDlg.ShowDialog();
|
|
|
|
|
I tried it, but its still not giving me System
colors only.
My problem is, that i load the color using the
System.Drawing.Color.FromName and when i do that,
i must have the name, and not the code like ffff0080.
To get the name I use the pictureBoxSomething.BackColor.Name!
|
|
|
|
|
Well do you see the "Define Custom Colors>>" button as disabled. I think this is all you need.
colorDlg.AllowFullOpen = false;
exactly does what you want. I guess by doing this the user can select only named colors.
Can you please elaborate on what is not working? I guess I did not understand you question well enough.
|
|
|
|
|
The AllowFullOpen disabled the "Define Costom Colors" as you said.
But some of the colors which the user still can select are not named colors.
At my Dialog, the color on the fourth row in the right side(somekind of blue color i think)
does not return a name, it gives me this code insted "ff8000ff" when i try to get the name.
Basicly my problem is very simple, i wants the colordialog to show colors
which only return named colors, so i can use them through the System.Drawing.Color.FromName event.
Is that possible?
|
|
|
|
|
Hello guys,
Does anybody know where i could find a decent reference for configuration files for .net 2.0
besides msdn2.microsoft.com ?
|
|
|
|
|
Im trying now to get the coords of the mouse on the SCREEN out side my form
i was thinking to use win32 WindowProc function on the desktop handler
( using getDesktopWindow() )
im familiar with using external functions like getDesktopWindow
but i just have no clue how to use WindowProc function ..
it suposed to get callback function or something
how to do it in c# ???
thanks
|
|
|
|
|
Have a look at System.Windows.Forms.Cursor.Position.
|
|
|
|
|
But it will only give me the position can i make a function which will catch mousemove event outside the window?
|
|
|
|
|
Search for global hooks here on CodeProject and you'll find some articles that describe how to do what you're looking for.
www.troschuetz.de
|
|
|
|
|
|
I have following:
string dec = "2";
string amount = "1000"
I want to put a decimal in 1000 based on dec number. So for instance if dec=3 >>> amount should become 10.000....if dec = 2, amount=100.00
How can I achieve this type of operation??
regards
|
|
|
|
|
how about something like this:
<br />
int iDec = int.Parse(dec)<br />
double dAmount = double.Parse(amount)<br />
dAmount *= 10;
dAmount /= Math.Pow(10,iDec);<br />
Amount = dAmount.ToString("f" + iDec);<br />
<code>
|
|
|
|
|
or
amount.Substring(0,amount.Length-(dec[0]-'0'))+"."+amount.SubString(amount.Length-(dec[0]-'0')
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
this worked for me. thanks
|
|
|
|
|
Is there any equivalent of the _MFC_VER macro for the C# preprocessor that allows the user to detect the CLR version at compile time? I saw something like _CLR_VER in the 2005 C++ docs, but nothing for VB.net, C# or C++ for the .NET 1.0, 1.1 versions. ( I am using C# 2003 latest service packs.)
.............................
There's nothing like the sound of incoming rifle and mortar rounds to cure the blues. No matter how down you are, you take an active and immediate interest in life.
Fiat justitia, et ruat cælum
|
|
|
|