|
Hi Jesse,
Check out the following:
using System.Diagnostics;
public class notepad
{
public static void Main(string[] args)
{
System.Diagnostics.Process process = new Process();
System.Diagnostics.ProcessStartInfo pStart = new ProcessStartInfo();
pStart.FileName = "notepad.exe";
pStart.Arguments = "a b c d";
process.StartInfo = pStart;
process.Start();
}
}
You can start using ProcessStartInfo to assign various attributes to Process and then start the process.
Does this help?
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
cool thanks alot man... it will help alot !! i got another question that maybe you can help me with.... i wrote a full featured wordpad type program.. with a spell checker and all images embedded with in the program. when its running it takes about 14 megs of memory....but ill load a txt file thats 7 megs in size into the program and all of a sudden it is taken 50+ megs. any ideas on how i can fix this problem.. heres how i open it... is there a better way that i use too conserver memory ?(when notpade opens this file it only takes 8 megs of memory)
*** begin code ***
<br />
FileStream fs = File.OpenRead(LoadFileOnStart);<br />
byte[] b;<br />
if(LoadFileOnStart.ToLower().EndsWith("rtf")|LoadFileOnStart.ToLower().EndsWith("doc")){<br />
fs = File.OpenRead(LoadFileOnStart);<br />
b = new byte[fs.Length];<br />
ASCIIEncoding temp = new ASCIIEncoding();<br />
while (fs.Read(b,0,b.Length) > 0) <br />
{<br />
MainTextArea.Rtf = temp.GetString(b);<br />
}<br />
}<br />
|
|
|
|
|
Hi, coders!
I have a little bit stupid question...But I couldn't find an answer to it so far
I wanted to add a menu item "delete" for a standart textbox control.
I am reading Charles Petzold's Programming windows width C# and he wrote in his book the following code to respond to menu item "delete" clicked:
txtBox.Clear();
The very problem is that this DO CLEAR the entire text in the control and I want only the selected one to be deleted.
Then I wrote that:
txtBox.Text = txtBox.Text.Remove(txtBox.SelectionStart,txtBox.SelectionLength);
txtBox.Modified = true;
It works but there is a little problem: as the text in the control is updated the caret is positioned at the beginning...Unfortunately .NET Framework don't provide something like MoveCaret function
Any ideas how could I implement that simple delete command(the only way I can think of is to override WndProc and the WM_CLEAR message - but no WIN32, right )
Regards!
Gogou
|
|
|
|
|
Gogou wrote:
Unfortunately .NET Framework don't provide something like MoveCaret function
O dear
MoveCaret =
SelectionLength = 0;<br />
SelectionStart = Text.Lenght - 1;
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
Well,I said it is stupid question
Tnx!
|
|
|
|
|
Hi,
Does anyone know of a way of getting any scolling events from a ListView control ? I want to be able to fill a ListView control on demand (paging) as it can display very large amounts of data. So as the user scrolls down i access and load rows.
Can this be done with the standard .Net Control ? Or is there a 3rd party control that can do this ?
Thanks ... Andy
|
|
|
|
|
Even though I haven't tested it for scrollers, I believe it would be fine if you override the System.Windows.Forms.ListView.WndProc method, and provide a switch case handler for WM_VSCROLL messages.
PS : if you thought you would get rid of WIN32 that easy, bad luck!
|
|
|
|
|
Thank you for Soliant's suggestion using the DataTableMapping object.
But I think the TableMapping function is just to map the data from source to datatable.
It doesn't specify the order of the columns in the dataset, does it?
I still can't figure out how I can display the data in my own way.
It is still in alphabetical order from left to right.
I've also tried using TableMapping property from the DataAdapter.
Did I do something wrong? or miss anything?
Please give me a little more detail about it. Thank you!
|
|
|
|
|
Very unusual case (I use Oracle, MSSQL and DB2).
Try to define Your own fields in DataGrid:
DataGridTextBoxColumn tc1,tc2;
DataGridTableStyle ts;
DataGrid myDataGrid;
tc1 = new DataGridTextBoxColumn();
tc1.MappingName="myColumn1Name";
...
tc2 = new DataGridTextBoxColumn();
tc2.MappingName="myColumn2Name";
...
ts = new DataGridTableStyle()
ts.MappingName = "myTableName";
...
ts.GridColumnStyles.AddRange(new DataGridColumnStyle[] { tc1,tc2 });
myDataGrid.TableStyles.AddRange(new DataGridTableStyle[]{ ts });
myDataGrid.DataSource = myTable
...
Sincerely
AW
|
|
|
|
|
Hello,
I have very serious problem with the control initialization while it is placed onto form in IDE form designer. I get an "object reference" error. Nobody knows how what is the source of the problem.
I have an idea to supress the control initialization while instantiated within the IDE's form designer. Does anybody have any idea how to distinguish between design time control initialization and runtime control initialization?
Thanks for any comments
Vasek
VB6, C#, MS DNA, MS .NET software developer
|
|
|
|
|
if (Site != null && Site.DesignMode)
{
}
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
Thanks for answer
Vasek
VB6, C#, MS DNA, MS .NET software developer
|
|
|
|
|
This is the code I have been writing. For any conversion from bmp to any other image format it works,from jpeg to gif , bmp or png files it works. But when I try a conversion from jpeg to tiff , this is the exception I kept receiveing and I can't see what it refers to:
Invalid parameter used.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
Does anyone has a clue or met a similar problem.Thanks
/*----------Beginning of the code-----------------*/
Bitmap bBitmapTemp = new Bitmap(bBitmapIm);<br />
imViewerSetCompression ("image/bmp", sfname, bBitmapTemp);<br />
<br />
imViewerSetCompression ("image/tiff", svdasFileName, bBitmapTemp);<br />
<br />
private void imViewerSetCompression (String sMimetype ,String sfilename, Bitmap myBitmap)<br />
{ <br />
ImageCodecInfo myImageCodecInfo;<br />
Encoder myEncoder;<br />
EncoderParameter myEncoderParameter;<br />
EncoderParameters myEncoderParameters;<br />
<br />
myImageCodecInfo = GetEncoderInfo (sMimetype);<br />
myEncoder = Encoder.Compression;<br />
myEncoderParameters = new EncoderParameters (1);<br />
myEncoderParameter = new EncoderParameter (myEncoder,(long)EncoderValue.CompressionLZW);<br />
myEncoderParameters.Param[0] = myEncoderParameter;<br />
myBitmap.Save (sfilename, myImageCodecInfo, myEncoderParameters); <br />
}
|
|
|
|
|
<might help>
make sure the result of the GetEncoderInfo(mimetype) gives a compatible codecinfo.
Namely you can compare your codecinfo instance with the one built by GDI+ by trying a direct call to GdipGetImageDecoders(...).
</might help>
(the reason is that behind the wheel the run-time uses GDI+ and these calls to obtain the infos : there might be a bug (in which case you could help yourself by interoping GDI+ directly); or you might make an approriate use of the System.Drawing.Bitmap logic).
|
|
|
|
|
I'm developing a control derived from the ListView control and need it to find it's position relative to the Form it's contained on.
In my test Form I have the ListView positioned on a TabPage, and all the normal positioning references (this.Bounds, this.Location, this.Top, this.Left, this.ClientRectangle etc) return 0 - which is it's correct position within the TabPage, but obviously has nothing to do with it's position on the parent Form.
Note that I do not need a reference to it's Screen location, just the X and Y coordinates to it's upper-left corner within the parent form - can anyone help?
|
|
|
|
|
you need to offset the location by adding the parent location.
int x = Left;<br />
for (Control thisParent = parent; thisParent != null; thisParent = thisParent.parent)<br />
x += thisParent.Left;
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Many thanks for the quick reply!
I tried implementing your suggestion as follows:
int x = Left;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
x += thisParent.Left;<br />
<br />
int y = Top;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
y += thisParent.Top;
No go though I'm afraid - what that ends up giving me is a screen reference, not a refence relative to the containing form. Perhaps it has something to do with the fact the the test app is MDI? Even if so, I'd like to make a control that will work reliably in both SDI and MDI apps.
|
|
|
|
|
just stop one level earlier
int x = Left;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
{<br />
if (this.Parent != null)<br />
x += thisParent.Left;<br />
}
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thanks for the tips Philip - after stopping one level before the MDI parent I still had a problem where the MDI child form was reporting negative location values. The final code I came up with looks like this:
int x = Left;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
{<br />
if (thisParent.Parent != null && thisParent.Left > 0)<br />
x += thisParent.Left;<br />
}<br />
<br />
int y = Top;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
{<br />
if (thisParent.Parent != null && thisParent.Top > 0)<br />
y += thisParent.Top;<br />
}
|
|
|
|
|
Hi,
I'm not too sure how to explain what I'm trying to do. Basically I want a developer to go "File | Add New Item" and choose an option like "Paul's XMLDB Form". This will then prompt the user for a connection string to a DB where it should store the form definition, and create a "form" in design view for them to edit. I've made some custom controls that I want the developer to be able to add to the form. I'd like the editing to look as close to the standard form editing in VS.Net, and when they choose to save it, it will write the definition off to the DB as an XML field.
Now I've tried looking at Designers, IDesignerHost, IRootDesigner, ComponentDesigner, etc, etc. But I'm not finding an easy way to do this. I thought I'd create my own add-in, which docks a window in VS.Net but now I can't get the toolbox to activate so I can drag components off it.
Does anyone know how I could do this?
Thanks
From
Paul
|
|
|
|
|
Hello,
How to generate a graphic in the c# asp .net? For example I build a graphic with the class GDI+ but I would like to transfer this image in asp .net. For example, I have two button in my web page with a graphic and texts (title ….), one button can add a circle the second choose the color for this. How to built that ?
Thanks in advance….
Thank in advance
-=zoltix=-
|
|
|
|
|
Look at my WebBoxes article.
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
|
|
Thanks a lot......it s percfect !!!!
-=zoltx=-
|
|
|
|