|
Simple commands like cmd or regedit can be called because they are programs that can be found with the PATH environment variable. Start->Run also finds programs using the registry key "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" if the program cannot be found using the PATH variable.
Registering new protocol like "ymsgr" is something different, but also quite easy: see http://msdn.microsoft.com/workshop/networking/pluggable/overview/appendix_a.asp[^]
|
|
|
|
|
You posted the exact same question in this exact forum less than 20 hours ago.
Why don't you follow up on the answers you get instead of spamming the forum with the same question again?
---
b { font-weight: normal; }
|
|
|
|
|
I want to know how can i make a wizard like a oledbconnection of Visual studio.net ,
exactly make something like the property Policy File of the component oledbconnection
|
|
|
|
|
I want to draw into a usercontrol when a make click in it at "DESIGN TIME"
|
|
|
|
|
Hello everybody,
How can i open a webpage in C# that has post data already sent to it(or download the HTML code of that page)
example:
A dictionary that uses POST to send the word to the result page. I need a program that can display the coresponding page for the required word.
Thanks in Advance
Afief
|
|
|
|
|
Hi Afief,
I'm not sure if I'm understanding you correctly, and whether you actually want to open a browser window to display the page, or to programmatically receive the content of a page as a result of a POST.
If it's the latter try something similar to below (untested) which POSTS a string to a web-page and captures the response also as a string:
static string Post(string url, string wordToPost)
{
// convert the word to post to a byte array
byte[] postData = new System.Text.ASCIIEncoding().GetBytes(wordToPost);
// create a web request
System.Net.WebRequest request = System.Net.WebRequest.Create(url);
// verb is POST
request.Method = "POST";
// add the post data to this request
System.IO.Stream postStream = request.GetRequestStream();
postStream.Write(postData, 0, postData.Length);
postStream.Close();
// send the request and collect the response
System.Net.WebResponse response = request.GetResponse();
// now read from the response stream the output
System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
string result = reader.ReadToEnd();
// tidy up
reader.Close();
response.Close();
// and return the content
return result;
}
Rgds,
Rob Philpott
|
|
|
|
|
Hi!
I am developing a windows application which crops an image by drawing a rectangle over the image using mouse (RubberBand Effect)
Can somebody tell me how do I keep the Aspect Ratio when drawing Rectangle over the image using mouse.
i.e. when drawing selection in Adobe PhotoShop with Aspect Ratio
Anxiously waiting for reply.
|
|
|
|
|
int startx,starty;
int x,y;
double ratio=1; // change this for photos or screen wallpapers(ie. 1.3333)
if(x<startx)
startx=x;
if(y<starty)
starty=y;
int length;
if((x-startx)="">(y-starty))
length=y-starty;
else
length=x-startx;
drawrect(startx,starty,startx+length,starty+length);
should work. you only have to write drawrect(int x, int y, int endx,int endy) procedure.
|
|
|
|
|
Hello Afief!
Thank you for replying, but, I did not understand your code, you have declared the variable "ratio" but you have not used it any where. I will be pleased if you read my code and modify it for Aspect Ratio functionality.
I will be grateful to you.
Here is my code
<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
<br />
namespace WinApp<br />
{<br />
public class frmAspect : System.Windows.Forms.Form<br />
{<br />
private int StartX = 0, StartY = 0, EndX = 0, EndY = 0;<br />
private bool bMouseDown = false;<br />
Rectangle rctRubber = Rectangle.Empty;<br />
<br />
<br />
private System.Windows.Forms.PictureBox pb;<br />
private System.Windows.Forms.Label lblMessage;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public frmAspect()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if(components != null)<br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.pb = new System.Windows.Forms.PictureBox();<br />
this.lblMessage = new System.Windows.Forms.Label();<br />
this.SuspendLayout();<br />
this.pb.Location = new System.Drawing.Point(16, 56);<br />
this.pb.Name = "pb";<br />
this.pb.Size = new System.Drawing.Size(336, 256);<br />
this.pb.TabIndex = 0;<br />
this.pb.TabStop = false;<br />
this.pb.Paint += new System.Windows.Forms.PaintEventHandler(this.pb_Paint);<br />
this.pb.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pb_MouseUp);<br />
this.pb.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pb_MouseMove);<br />
this.pb.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pb_MouseDown);<br />
this.lblMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br />
this.lblMessage.Location = new System.Drawing.Point(368, 0);<br />
this.lblMessage.Name = "lblMessage";<br />
this.lblMessage.Size = new System.Drawing.Size(288, 256);<br />
this.lblMessage.TabIndex = 1;<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(680, 566);<br />
this.Controls.Add(this.lblMessage);<br />
this.Controls.Add(this.pb);<br />
this.Name = "frmAspect";<br />
this.Text = "frmAspect";<br />
this.Load += new System.EventHandler(this.frmAspect_Load);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
private void frmAspect_Load(object sender, System.EventArgs e)<br />
{<br />
pb.Image = Image.FromFile( @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg");<br />
pb.SizeMode = PictureBoxSizeMode.StretchImage;<br />
}<br />
<br />
private void pb_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
pb.Cursor = Cursors.Cross;<br />
rctRubber.X = e.X;<br />
rctRubber.Y = e.Y;<br />
Cursor.Clip = pb.RectangleToScreen(pb.ClientRectangle);<br />
bMouseDown = true;<br />
}<br />
<br />
private void pb_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
Cursor.Clip = Rectangle.Empty;<br />
bMouseDown = false;<br />
pb.Cursor = Cursors.Default;<br />
}<br />
<br />
private void pb_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if (bMouseDown == false) {return;}<br />
pb.Cursor = Cursors.Cross;<br />
rctRubber.Width = Math.Max(e.X,rctRubber.X) - rctRubber.X;<br />
rctRubber.Height = Math.Max(e.Y, rctRubber.Y) - rctRubber.Y;<br />
<br />
pb.Invalidate();<br />
<br />
}<br />
<br />
private void pb_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
if (bMouseDown == false)<br />
{<br />
return;<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
lblMessage.Text = "PB ClientRectange: " + pb.ClientRectangle.ToString()+ "\n" +<br />
"Rubber Rectangle: " + rctRubber.ToString();<br />
<br />
<br />
<br />
<br />
Pen pen = new Pen(Color.Red, 2);<br />
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;<br />
<br />
e.Graphics.DrawRectangle(pen,rctRubber);<br />
<br />
<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Hi there,
I'm trying to check whether a string contains numbers. Here is my code, which obviously doesn't work. How do I check properly for matches? In this example, I've been using the Match.Length property. As well I tried with the Match.Success property but it doesn't seem to work either.
string sEx = "[0-9]*";
string sText = "hi t 2 o all of you!";
Match m = Regex.Match(sText, sEx);
if (m.Length > 0)
Console.WriteLine("worked");
else
Console.WriteLine("didn't work");
Any help is greatly appreceated!
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
The regex will "[0-9]*" will search for zero or more digits, so it will find zero digits in any string. (in your example, it will find the zero-length string in front of "hi")
Use 'Regex.IsMatch(sText, "[0-9]")', which will return true as soon as one digit is found.
|
|
|
|
|
Hi Daniel,
thanks a lot, that helped.
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
Hello,
I have windows form i need to apply a skin to it by already designed image ,it is possible?
|
|
|
|
|
Hai every body,
I am working on project related to industrial security.
I have to display the camera input in a windows form.
Is there any control available for live video display in dotnet frame work.
If no control is aavailable in the dotnet frame work please suggest me a good third party control.
Please healp me.
Varmag
varmag
|
|
|
|
|
I have a simple question but couldnt find an answer from the web yet...
How can i plot a set of points with known x and y values on a windows form?
Using Graphics? Pen?
|
|
|
|
|
You create an event handler for the paint event of the element where you want them drawn. Invalidate the element to cause it to be redrawn.
---
b { font-weight: normal; }
|
|
|
|
|
hi,
i have a problem.i'm usin Component one TrueDbGrid. Also i have dragged a dateTimePicker on it..as per the samples which Component One had, i wrote the code for a particular column to be of type "dateTimpicker"..ther code comes in RowColChange event of the trueDbGrid...
private void c1TrueDBGrid1_RowColChange(object sender, C1.Win.C1TrueDBGrid.RowColChangeEventArgs e)
{
// position the datetime picker on the "BirthDate" column only
C1.Win.C1TrueDBGrid.C1DataColumn col = this.c1TrueDBGrid1.Splits[0].DisplayColumns[this.c1TrueDBGrid1.Col].DataColumn;
if( col.DataField == "BirthDate" )
{
// get the area of the cell
Rectangle r = this.c1TrueDBGrid1.Splits[0].GetCellBounds(this.c1TrueDBGrid1.Row, this.c1TrueDBGrid1.Col);
// change to screen coordiantes
r = this.c1TrueDBGrid1.RectangleToScreen(r);
// map the screen coordinates to the forms client coordinates
this.dateTimePicker1.Location = this.RectangleToClient(r).Location;
// size it to fit inside the cell
this.dateTimePicker1.Size = r.Size;
// default the dateTimePicker to the date in the cell
this._bIgnoreChange = true;
this.dateTimePicker1.Text = col.CellText(this.c1TrueDBGrid1.Row);
this._bIgnoreChange = false;
// display it
this.dateTimePicker1.Visible = true;
}
else
this.dateTimePicker1.Visible = false;
}
so here if the col == "BirthDate", then tat field where i've clicked, becomes of dateTimPicker...but my problem is the dateTimepicker is visible but it doesn't get the correct size and location...y this happens i dont understand...
plz..help me..m stuck...
|
|
|
|
|
is there a fix for this so called bug ?
i am getting my icons from Win32.SHGetFileInfo(), then adding it to an imagelist on a treeview, but they appear black where they should be transparent. i am not setting any transparent colour, but form what i remember last time i tried this it didnt do anything anyway.
is there a solution ?
kind regards,
g00fy
|
|
|
|
|
how can i find all the ZIP files in a particular directory and its subdirectories.
|
|
|
|
|
System.IO.Directory and System.IO.DirectoryInfo have methods for returning files and subdirectories (GetDirectories(), GetFiles() etc.) which you can use for this.
Are you looking for ZIP files just in the immediate subdirectories, or in all subdirectories of subdirectories of subdirectories etc?
Rob Philpott
|
|
|
|
|
|
It would be helpful if you informed us about the reason for your inability to convert the string.
If the string contains anything that can be converted to an int, it's easy:
myInt = Convert.ToInt32(myString)
---
b { font-weight: normal; }
|
|
|
|
|
Hello
May be you need to try this:
int.Parse( str )
or this:
Convert.ToInt32( str )
With best regards,
Andrew Kirillov, MCP x 3
Prize winner, August 2005
|
|
|
|
|
Hi all,
I have a richtextbox and a vertical scrollbar on the form
now when i enter text into the richtextbox after it exceeds it's height
the scrollbar for the richtext is shown and we can scroll the contents of the
richtext,
Now i want to hide this scrollbar and want the contents to be scrolled
using the vertical scrollbar that i have put on the form.
Any code or hint will be helpful
Thanks and Regards,
Pramod
|
|
|
|
|
set your scrollbars to 'none' and use the SendMessage API call to control the scrolling
e.g.,
<br />
using System.Runtime.InteropServices;<br />
<br />
private const int WM_SCROLL = 276;
private const int WM_VSCROLL = 277;
private const int SB_LINEUP = 0;
private const int SB_LINELEFT = 0;
private const int SB_LINEDOWN = 1;
private const int SB_LINERIGHT = 1;
private const int SB_PAGEUP = 2;
private const int SB_PAGELEFT = 2;
private const int SB_PAGEDOWN = 3;
private const int SB_PAGERIGTH = 3;
private const int SB_PAGETOP = 6;
private const int SB_LEFT = 6;
private const int SB_PAGEBOTTOM = 7;
private const int SB_RIGHT = 7;
private const int SB_ENDSCROLL = 8;
<br />
[DllImport("user32.dll",CharSet=CharSet.Auto)]<br />
private static extern int SendMessage(IntPtr hWnd, int wMsg,IntPtr wParam, IntPtr lParam);<br />
then call SendMessage() and the way you want to scroll
hope that helps
g00fy
|
|
|
|