'C#'에 해당되는 글 28건
- 2012/03/21 visualp [c#]인터넷 주소창 주소 구하기
- 2011/11/25 visualp c# 프로세스 강제종료, kill process
- 2011/11/25 visualp C# 특정 폴더 열기
- 2010/10/08 visualp c# 이미지 합치기(image marge using c/#)
- 2010/10/08 visualp C# 배열 중복제거
- 2010/07/13 visualp c# 특정 키 누르기 ,
- 2010/06/09 visualp WebBrowser Control browser_DocumentCompleted 이벤트 시점 체크
- 2010/05/25 visualp c# javascript escape함수와 , unescape
- 2010/04/09 visualp 윈도우 종료 하기
- 2010/04/06 visualp Link Label
[참조2]:http://blog.naver.com/PostView.nhn?blogId=yunani99&logNo=30111649113
(패킷캡쳐)
[참조3]:http://www.codeproject.com/Articles/4217/Packet-Sniffing-with-Winpcap-Functions-Ported-to-a
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/469
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/469
{
Process[] process = Process.GetProcessesByName(processName);
Process currentProcess = Process.GetCurrentProcess();
foreach (Process p in process)
{
if (p.Id != currentProcess.Id)
p.Kill();
}
}
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/429
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/429
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/428
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/428
[출처]- http://dragonwind.egloos.com/4849313
1. ASP.net 1.0 기준으로 web form 에서 이미지를 합쳐서 저장하기.
---------------------------------------------------------------------------
Bitmap bmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmap);
System.Drawing.Image img = Bitmap.FromFile("d:\\hoonslogo.gif");
System.Drawing.Image img2 = Bitmap.FromFile("d:\\btn_individual.gif");
g.DrawImage(img, 0, 0);
g.DrawImage(img2, 50, 50);
bmap.Save("d:\\MyTest.gif", System.Drawing.Imaging.ImageFormat.Jpeg);
---------------------------------------------------------------------------
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=17&MAEULNo=8&no=49092&ref=49092
2. win form 에서 이미지 합치고, picturebox 에 쓰기
---------------------------------------------------------------------------
private void menuItem2_Click(object sender, System.EventArgs e)
{
//select files...
openFileDialog1.ShowDialog();
if( openFileDialog1.FileNames.Length > 0 )
{
Bitmap canvas = new Bitmap(50,50*openFileDialog1.FileNames.Length);
int index = 0;
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(canvas);
foreach( string filename in openFileDialog1.FileNames )
{
System.Drawing.Image img = System.Drawing.Image.FromFile(filename);
g.DrawImage(img,0,50*index,50,50);
index++;
}
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(thumbnailCallback);
pictureBox1.Image = canvas.GetThumbnailImage(50,50*openFileDialog1.FileNames.Length,myCallback,IntPtr.Zero);
canvas.Save("temp.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
public bool thumbnailCallback()
{
return false;
}
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/317
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/317
private string[] ArrayDistinct(string[] source)
{
// generic버전
//List<string> temp = new List<string>();
//temp.AddRange(source);
//IEnumerable<string> distinct = temp.Distinct();
//return distinct.ToArray<string>();
// 막..장 버전
string destination = string.Empty;//임시 필드
// 중복제거
for (int i = 0; i < source.Length; i++)
{
for (int j = 0; j < source.Length; j++)
{
if (source[i] == source[j] && i != j) source[j] = string.Empty;
}
}
// ,를 구분자로 문자열 생성
for (int i = 0; i < source.Length; i++)
{
if (!source[i].Equals(string.Empty)) destination += source[i] + ",";
}
// 마지막에 붙은 ,하나 제거
destination = destination.Substring(0, destination.Length - 1);
return destination.Split(',');
}
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/316
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/316
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
Use SendKeys to send keystrokes and keystroke combinations to the active application. This class cannot be instantiated. To send a keystroke to a class and immediately continue with the flow of your program, use Send. To wait for any processes started by the keystroke, use SendWait.
Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, pass in the string "A" to the method. To represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, specify the parameter as "ABC".
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use "{+}". To specify brace characters, use "{{}" and "{}}". Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that might be significant when dynamic data exchange (DDE) occurs.
To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes in the following table.
| Key | Code |
|---|---|
| BACKSPACE | {BACKSPACE}, {BS}, or {BKSP} |
| BREAK | {BREAK} |
| CAPS LOCK | {CAPSLOCK} |
| DEL or DELETE | {DELETE} or {DEL} |
| DOWN ARROW | {DOWN} |
| END | {END} |
| ENTER | {ENTER}or ~ |
| ESC | {ESC} |
| HELP | {HELP} |
| HOME | {HOME} |
| INS or INSERT | {INSERT} or {INS} |
| LEFT ARROW | {LEFT} |
| NUM LOCK | {NUMLOCK} |
| PAGE DOWN | {PGDN} |
| PAGE UP | {PGUP} |
| PRINT SCREEN | {PRTSC} (reserved for future use) |
| RIGHT ARROW | {RIGHT} |
| SCROLL LOCK | {SCROLLLOCK} |
| TAB | {TAB} |
| UP ARROW | {UP} |
| F1 | {F1} |
| F2 | {F2} |
| F3 | {F3} |
| F4 | {F4} |
| F5 | {F5} |
| F6 | {F6} |
| F7 | {F7} |
| F8 | {F8} |
| F9 | {F9} |
| F10 | {F10} |
| F11 | {F11} |
| F12 | {F12} |
| F13 | {F13} |
| F14 | {F14} |
| F15 | {F15} |
| F16 | {F16} |
| Keypad add | {ADD} |
| Keypad subtract | {SUBTRACT} |
| Keypad multiply | {MULTIPLY} |
| Keypad divide | {DIVIDE} |
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes.
| Key | Code |
|---|---|
| SHIFT | + |
| CTRL | ^ |
| ALT | % |
To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".
To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.
Note Because there is no managed method to activate another application, you can either use this class within the current application or use native Windows methods, such as FindWindow and SetForegroundWindow, to force focus on other applications.
// Clicking Button1 causes a message box to appear.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
MessageBox.Show("Click here!");
}
// Use the SendKeys.Send method to trigger the Button1 click event
// and display the message box.
private void Form1_DoubleClick(object sender, System.EventArgs e)
{
// Send the enter key; since the tab stop of Button1 is 0, this
// will trigger the click event.
SendKeys.Send("{ENTER}");
}
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/294
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/294
프레임에 프레임이 들어 있는 페이지 같으 경우 다음과 같이 처리 하지 않는다면, 브라우저가 로딩 되어지는 정확한 시점을 찾아 낼 수 없다.
페이지 스크립팅 할 때 유용하게 이용할 수 있을거 같다.
if (browser.ReadyState == WebBrowserReadyState.Complete{
//TODO 내용 구현
}
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/280
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/280
2.
escape => Microsoft.JScript.GlobalObject.escape("바꿀 문자열");
unescape => Microsoft.JScript.GlobalObject.unescape("바꿀 문자열");
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/269
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/269
댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/238
댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/238
[원문] : http://www.csharphelp.com/2006/06/an-overview-of-link-label-in-c/
Introduction:
The LinkLabel control exhibits links to otherobjects, such as files or Web pages. Class LinkLabel is derived fromclass Label and therefore inherits all of class Label�s functionality.A LinkLabel looks as underlined text. When the mouse moves above thelink, the pointer modify to a hand. This is alike to the behavior of ahyperlink in a Web page. The link can change color to indicate whetherthe link is new, visited or active. When clicked, the LinkLabelgenerates a LinkClicked event.
Class LinkLabel :
Class LinkLabel is derived from class Label and therefore inherits all ofclass Label�s functionality. Hand image displays when mouse moves over LinkLabel.
Some common Properties of LinkLabel:
ActiveLinkColor – Denotes the color of the active link when clicked. Default is red.LinkColor – Denotes the original color of every links prior to they have been visited. Default is blue.
Links – Lists the LinkLabel Link objects, which are the links enclosed in the LinkLabel.
LinkVisited – If True, link appears as though it were visited (itscolor is changed to that specified by property VisitedLinkColor).
Text – Denotes the text to show on the control.
VisitedLinkColor – Denotes the color of visited links. Default is purple.
LinkArea – Denotes which part of text in the LinkLabel is treated as element of the link.
LinkBehavior – Denotes the link�s behavior, for example how the link come into view when the mouse is positioned over it.
LinkClicked – Generated when link is clicked.
Now let us see the usage of LinkLabel control with an example:
In this example I place a LinkLabel control with the text "To know C# -visit www.csharpheaven.com – Click Here!" and provide a link to aportion of the text. So that when clicked, the LinkLabel generates aLinkClicked event.
The Example:
using System;
using System.Drawing;
using System.ComponentModel;
using System.WinForms;
public class LinkLabel : System.WinForms.Form {
private System.WinForms.LinkLabel linkLabel1;
public LinkLabel() {
InitializeComponent();
}
public override void Dispose() {
base.Dispose();
}
public static void Main(string[] args) {
Application.Run(new LinkLabel());}
private void InitializeComponent()
{
this.linkLabel1 = new System.WinForms.LinkLabel();
linkLabel1.Text = "To know C# – visit www.csharpheaven.com – Click Here!";
linkLabel1.Size = new System.Drawing.Size(168, 56);
linkLabel1.LinkColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)128,(byte)255, (byte)255);
linkLabel1.LinkArea = new System.Drawing.Point(42, 11);
linkLabel1.ForeColor = System.Drawing.Color.Maroon;
linkLabel1.Font = new System.Drawing.Font("Times New Roman", 10f,
System.Drawing.FontStyle.Bold);
linkLabel1.TabIndex = 0;
linkLabel1.TabStop = true;
linkLabel1.Location = new System.Drawing.Point(8, 16);
linkLabel1.LinkClick += new System.EventHandler(linkLabel1_LinkClicked);
this.Controls.Add(linkLabel1);
this.BackColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128);
}
protected void linkLabel1_LinkClicked(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start("IExplore"," http://www.csharphelp.com");
}
}
Here the above program is written by hand (Adding LinkLabelcontrol to a form programmatically)
The program below is the code generated by the WINDES.exe.
// Win32Form1.cs
namespace Win32Form1Namespace {
using System;
using System.Drawing;
using System.ComponentModel;
using System.WinForms;
/// <summary>
/// Summary description for Win32Form1.
/// </summary>
public class Win32Form1 : System.WinForms.Form {
/// <summary>
/// Required by the Win Forms designer
/// </summary>
private System.ComponentModel.Container components;
private System.WinForms.LinkLabel linkLabel1;
public Win32Form1() {
// Required for Win Form Designer support
InitializeComponent();
// TODO: Add any constructor code after InitializeComponent call
}
/// <summary>
/// Clean up any resources being used
/// </summary>
public override void Dispose() {
base.Dispose();
components.Dispose();
}
/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main(string[] args) {
Application.Run(new Win32Form1());
}
/// <summary>
/// Required method for Designer support – do not modify
/// the contents of this method with an editor
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.linkLabel1 = new System.WinForms.LinkLabel();
//@design this.TrayHeight = 0;
//@design this.TrayLargeIcon = false;
//@design this.TrayAutoArrange = true;
linkLabel1.Text = "To know C# – visit www.csharpheaven.com – Click Here!";
linkLabel1.Size = new System.Drawing.Size(184, 56);
linkLabel1.LinkColor = System.Drawing.Color.Teal;
linkLabel1.LinkArea = new System.Drawing.Point(42, 11);
linkLabel1.ForeColor = System.Drawing.Color.Maroon;
linkLabel1.Font =
new System.Drawing.Font("Times New Roman", 10f, System.Drawing.FontStyle.Bold);
linkLabel1.TabIndex = 0;
linkLabel1.DisabledLinkColor = System.Drawing.Color.Yellow;
linkLabel1.TabStop = true;
linkLabel1.Location = new System.Drawing.Point(8, 16);
linkLabel1.BackColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)192, (byte)128);
linkLabel1.LinkClick += new System.EventHandler(linkLabel1_LinkClick);
this.Text = "Win32Form1";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.KeyPreview = true;
this.TransparencyKey = System.Drawing.Color.White;
this.BackColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128);
this.ClientSize = new System.Drawing.Size(272, 149);
this.Click += new System.EventHandler(Win32Form1_Click);
this.Controls.Add(linkLabel1);
}
protected void Win32Form1_Click(object sender, System.EventArgs e)
{
}
protected void linkLabel1_LinkClick(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start("IExplore", "http://www.csharphelp.com" );
linkLabel1.LinkVisited = true;
}
}
}






글