|
thank Rod answered my questions
from fretre
|
|
|
|
|
Hello,
I need to write code to insert a user selected picture into a RichTextBox.
After checking the RTF file generated by WordPad, I found I can use the
following code to add a picture into RichTextBox:
string text = "";
text +=
"{\\rtf1\\ansi\\ansicpg936\\deff0\\deflang1033\\deflangfe2052{\\fonttbl{\\f0
\\fnil\\fcharset0 Microsoft Sans Serif;}}\n";
text +=
"\\uc1\\pard\\lang2052\\f0\\fs17{\\pict\\wmetafile8\\picwgoal480\\pichgoal24
0\n";
text += "............."; // data here
text += "\n}}";
richTextBox1.SelectedRtf = text;
But, I still do not know how to encodethe data field automatically.
Currently I can only paste it from the WordPad generated RTF.
Is there some easier way to let user select a bitmap file(bmp, jpg, etc.),
then insert it to the RichTextBox control?
Thank you very much,
weixiang
|
|
|
|
|
I personally would rely on the clipboard, ie load the image into the clipboard and use the RichTextBox.Paste(Format frmt) method to produce the stream.
This stream can then be saved to disk for reuse with RichTextBox.SaveFile(path) .
|
|
|
|
|
That's a good method. Thank you, .S.Rod
|
|
|
|
|
Hi,
Is there a way to run a program as a specified username? Just like RUNAS
command in windows?
Please help me.
Thanks.
|
|
|
|
|
If you can't find a specified function in the .NET doc, then consider using P/Invoke and realy on WIN32 functions instead (CreateProcessAsUser() seems to be the one useful in your case).
|
|
|
|
|
System.Diagnostics.Process p=new System.Diagnostics.Process();
p.StartInfo.FileName= "arj.exe ";
p.StartInfo.Arguments= "-x sourceFile.Arj c:\temp ";
p.Start();
if(p.HasExisted)
p.kill();
|
|
|
|
|
This indeed starts a process, but the question was to start a process under a given user profile, which is different.
|
|
|
|
|
Hi
Is there a new ECMA submission or spec. from MS for C# that covers the new 1.1 features?
Perhaps like 2001/2002 's version of the C# specification word doc from Anders H., et al...
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
SimonS wrote:
the new 1.1 features?
What features ?
Generics ? They are planned for Yukon.
|
|
|
|
|
There are very few language changes in 1.1.
IIRC, the ones that are there are to conform with the ECMA spec.
|
|
|
|
|
Could someone help me with sorting in treeview ? Exist something like callback function ?
Thanx
W.
|
|
|
|
|
First of all, set the System.Windows.TreeView.Sorted property to true.
Then, anytime you add a node, it calls the TreeNode.AddSorted(object) method instead of just adding it to the tail. The AddSorted(object) implementation has the compare function you can derive from and is as follows :
int AddSorted(TreeNode node) {
int local0;
int local1;
int local2;
int local3;
string local4;
CompareInfo local5;
local0 = 0;
local4 = node.Text;
if (this.childCount > 0) {
local5 = Application.CurrentCulture.CompareInfo;
if (local5.Compare(this.children[this.childCount - 1].Text, local4) <= 0)
local0 = this.childCount;
else {
local1 = 0;
local2 = this.childCount;
while (local1 < local2) {
local3 = local1 + local2 / 2;
if (local5.Compare(this.children[local3].Text, local4) <= 0) {
local1 = local3 + 1;
continue;
}
local2 = local3;
}
local0 = local1;
}
}
node.SortChildren();
this.InsertNodeAt(local0, node);
return local0;
}
|
|
|
|
|
hi,
Is it possible to get mouse and key event that owned by other application?
is there anyway in c#?
thank a lot
|
|
|
|
|
|
I'm getting the following error message:
the DB2OLEDB provider is not registered on the local machine.
from where can I download this driver on the web?
Jassim Rahma
|
|
|
|
|
You've got to download[^] the IBM client software.
|
|
|
|
|
I am having a problem with one event consuming two other events. I.e. I have a ListView with a DoubleClick event and a ContextMenu . When I add a mouseDown event for drag and drop operations, the DoubleClick event no longer fires and the ContextMenu opens only on occasion.
Any Ideas?
|
|
|
|
|
Provide implementation for the OnItemDrag event handler instead.
|
|
|
|
|
Thanks
|
|
|
|
|
Is there a standard or common way to make a serial number type protection on my windows app? I mean I could just whip something up, a text box and "please enter the serial number" and then save it to the registry, but there's probably more to it I should be aware of. Any articles on this out there?
I also will need to make an installer which I've never done before, where should I start?
thanks as always
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Bog wrote:
Is there a standard or common way to make a serial number type protection on my windows app? I mean I could just whip something up, a text box and "please enter the serial number" and then save it to the registry, but there's probably more to it I should be aware of. Any articles on this out there?
From what I know, there are only useful code templates from installer IDEs. The reason for it is that licensing is not a one point blocker, it often tells what components a customer can install and use. This involves knowledge about the target product itself.
If you need a ready-to-use template, browse the InstallShield devzone.
Bog wrote:
I also will need to make an installer which I've never done before, where should I start?
VisualStudio.NET comes with Setup And Deployment project wizards, which produce .msi setups. As long as you don't need strong custom install rules, the GUI has all you need to create a setup with a few drag&drops.
|
|
|
|
|
Bog wrote:
I also will need to make an installer which I've never done before, where should I start?
Possibly http://www.installsite.com[^]
This place saved my life when I was learning about installers. Look at anything involving Windows Installer.
Bob Baker's book[^] is great if you ever need a really in-depth guide. Even though it's based around InstallShield Developer, the first half of the book is solely about Windows Installer.
Paul
Pleasently caving in, I come undone - Queens of the Stone Age, No One Knows
|
|
|
|
|
It's very difficult producing a good level of protection on a piece of software. If you want to know more about it just do a search on Google for reverse engineering, in particular there used to be an excellent website with loads of essays on how people cracked various software programs -- do a search for Fravia on Google to see more.
In the end, you may either want to just purchase something from another Company (stronger than just knocking something up in 2 mins, but a generic protection system will have a generic patch that works across anything protected with it!) or alternatively just accept that people will copy it and try to figure out a way to encourage people to purchase full licenses to it.
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
inno setup is a good (free installer) i would recommend a program called (my inno setup exstentions) it supports registry entrys from the install (i.e it will write a key if told that tells you were the selected directory is.
its probally innosetup.com or run a search at altavista for innosetup.
|
|
|
|