2020. 10. 31. 09:56
윈도우폼
윈폼의 Debug로그이다.
System.Diagnostics.Debug.WriteLine("디버그 메세지");
팝업띄우는 버전
System.Windows.Forms.MessageBox.Show("디버그 메세지");
윈폼 리퀘스트
//v2
public static string DownloadText(string url)
{
try
{
var webClient = new System.Net.WebClient();
return webClient.DownloadString(url);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}
//v1
/*
public static string DownloadText(string url)
{
try
{
var webClient = new System.Net.WebClient();
var response = webClient.OpenRead(url);
using (var streamReader = new System.IO.StreamReader(response))
{
string result = streamReader.ReadToEnd();
streamReader.Close();
return result;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}
*/
현재 컴퓨터 유저 이름을 반환합니다.
System.Environment.UserName
Lerp
double Lerp(double a,double b,double t)
{
//return a*(1.0-t)+b*t;
return a + (b - a)* t;
}
Vector3 Lerp(Vector3 a, Vector3 b, float t)
{
return a + (b - a)* t;
}
새창 띄울때
var form = Application.OpenForms[nameof(Form2_Prediction)];
if (form==null)
{
form = new Form2_Prediction();
form.Show();
}
else
{
form.Activate();
}
프로세스 확인 (unity가 켜져있는지 확인하는 코드이다)
var processes=System.Diagnostics.Process.GetProcesses();
var processesNames = System.Array.ConvertAll(processes, x => x.HasExited ?"": x.ProcessName).ToList();
processesNames = processesNames.GroupBy(x=>x).Select(x=>x.First()).ToList();
processesNames = processesNames.FindAll(x => string.IsNullOrWhiteSpace(x) == false);
processesNames = processesNames.FindAll(x => x.ToLower().Contains("unity"));
foreach (var processesName in processesNames)
{
Debug.Log(processesName);
}
콤보박스에 Enum 할당
var ProportionalOptionNames = System.Enum.GetNames(typeof(ProportionalOption));
ProportionalOptionBoxs[i].Items.AddRange(ProportionalOptionNames);
window form
.net
닷넷
'윈도우폼' 카테고리의 다른 글
윈폼 키보드마우스 (0) | 2021.01.17 |
---|---|
c# 멀티스레드 기본소스 (0) | 2020.11.23 |
c# 윈도우 폼 (0) | 2018.01.28 |