Programming/c# & winform2020. 11. 13. 16:27

InitializeForm() 에

this.TopMost = true;

하면 끝이긴한데.. 문제는 자식 다이얼로그 보다도 위로 가버려서

띄우자 마자 자식 다이얼로그가 사라져버린다.

 

다이얼로그 속성에도 있으니 굳이 코드로 입력하지 않아도 된다.

 

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.windows.forms.form.topmost?view=net-5.0]

Posted by 구차니
Programming/c# & winform2020. 11. 13. 14:19

아래처럼 다이얼로그 초기화 하기전에

this.Font를 강제로 지정하면 폰트가 변경된다.

public MainDialog()
{
    //this.Font = SystemFonts.MessageBoxFont;
    this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
    InitializeComponent();
    InitializeForm();
}

[링크 : https://stackoverflow.com/questions/297701/default-font-for-windows-forms-application]

 

단, 다이얼로그의 속성중 AutoScaleMode를

Font에서 None으로 바꾸어 주어야 폰트가 바뀐다고 디자인이 깨지지 않는다

(물론 Label이 너무 가까이 있으면 덮어써지는건 매한가지니 주의)

Posted by 구차니
Programming/c# & winform2020. 11. 12. 18:08

기본 폰트가 굴림이라 다른걸로 바꾸려고 하니

이미 다른 컨트롤들은 굴림으로 되어버렸고

그 와중에 다이얼로그 크기가 확 바뀌어리길래 찾아보니

AutoScaleMode 라는게 존재하는데 기본값이 Font로 되어있어서 폰트를 바꾸면 그에 맞게 크기게 변경된다.

None으로 해주는게 나을것 같긴한데..

그나저나 영문 윈도우 기본 폰트는 먼지 검색이 안되네..

 

 

 

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.windows.forms.autoscalemode?view=net-5.0]

[링크 : https://mydoh.tistory.com/27]

 

+

2020.11.13

Microsoft Sans Serif, 8이 기본인가?

[링크 : https://youtu.be/-LO4A5rapek?t=43]

'Programming > c# & winform' 카테고리의 다른 글

c# winform always on top = TopMost  (2) 2020.11.13
c# winform 기본 폰트 변경하기  (2) 2020.11.13
C# 시간 관련 클래스  (0) 2020.11.10
c# 문자열을 시간으로  (6) 2020.11.06
c#에서 ini 파일 사용하기  (0) 2020.11.05
Posted by 구차니
Programming/c# & winform2020. 11. 10. 17:38

DateTime이 강력하고 편하긴 한데

unix epoch time이나 상수로 시간을 지정하는 등의 기능을 제공하지 않아서

시간 관련 구조체를 찾아보는 중.

 

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetime?view=netcore-3.1]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetimeoffset?view=netcore-3.1]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetimeoffset.tounixtimeseconds?view=netcore-3.1]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetimekind?view=netcore-3.1]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/datetime/converting-between-time-zones]

 

+ 2020.11.11

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/datetime/converting-between-datetime-and-offset]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/datetime/choosing-between-datetime]

 

DateTime.Ticks 의 경우 1970년 1월 1일 0시 0분 0초의 epoch 보다는 엄청 늘어난 long type을 반환한다.(singed 64bit)

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetime.ticks?view=net-5.0]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/csharp/language-reference/builtin-types/integral-numeric-types]

Posted by 구차니
Programming/c# & winform2020. 11. 6. 18:01

+ 2020.11.10

 

상당히 강력하게 해석을 해주는데 문제는.. 5/1/2008이 5월 1일인지 1월 5일인지 모르겠는데

일단은 "월/일/년" 으로 해석을 해준다. 다른 언어권에서도 저렇게 해주려나?

DateTime.Parse("5/1/2008 8:30:52 AM", System.Globalization.CultureInfo.InvariantCulture)

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetime?view=netcore-3.1]

 

---

 

[링크 : https://j07051.tistory.com/590]

[링크 : https://stackoverflow.com/questions/15203534/convert-todatetime-how-to-set-format]

[링크 : https://stackoverflow.com/questions/21383045/convert-string-to-datetime-with-form-yyyy-mm-dd-hhmmss-in-c-sharp/21383146]

'Programming > c# & winform' 카테고리의 다른 글

winform c# 폰트 바꾸면 다이얼로그 크기가 바뀐다?  (2) 2020.11.12
C# 시간 관련 클래스  (0) 2020.11.10
c#에서 ini 파일 사용하기  (0) 2020.11.05
C# UTC -> 지역시간  (0) 2020.11.05
c# gps(nmea parser)  (0) 2020.11.05
Posted by 구차니
Programming/c# & winform2020. 11. 5. 17:46

환경 설정파일로 ini 만한게 없긴하지..

 

[링크 : https://www.nuget.org/packages/ini-parser/]

[링크 : https://wookoa.tistory.com/417]

[링크 : https://github.com/Enichan/Ini]

 

'Programming > c# & winform' 카테고리의 다른 글

C# 시간 관련 클래스  (0) 2020.11.10
c# 문자열을 시간으로  (6) 2020.11.06
C# UTC -> 지역시간  (0) 2020.11.05
c# gps(nmea parser)  (0) 2020.11.05
c# label rotate  (0) 2020.11.04
Posted by 구차니
Programming/c# & winform2020. 11. 5. 15:39

위는 결과는 UTC 시간을 출력해주고

아래 결과는 지역시간(한국이니 UTC+9 = KST)으로 출력된다

label2.Text = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString();
label2.Text = DateTime.Now.ToString();

 

GPS 에서 사용하는 스타일로 UTC를 출력하기

DateTime utc = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
label2.Text = "" + String.Format("{0:D2}", utc.Year % 100) + String.Format("{0:D2}", utc.Month) + String.Format("{0:D2}", utc.Day);
label2.Text += " " + String.Format("{0:D2}", utc.Hour) + String.Format("{0:D2}", utc.Minute) + String.Format("{0:D2}", utc.Second);

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetime.tolocaltime?view=netcore-3.1]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/datetime/converting-between-time-zones]

 

+

2020.11.06

 

utc를 저장하고 ToLocalTime() 한번 실행해주면 지역시간으로 바뀐다.

public DateTime ToLocalTime ();

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.datetime.tolocaltime?view=netcore-3.1]

'Programming > c# & winform' 카테고리의 다른 글

c# 문자열을 시간으로  (6) 2020.11.06
c#에서 ini 파일 사용하기  (0) 2020.11.05
c# gps(nmea parser)  (0) 2020.11.05
c# label rotate  (0) 2020.11.04
c# tooltip  (0) 2020.11.04
Posted by 구차니
Programming/c# & winform2020. 11. 5. 15:00

내가 필요한건 NMEA 값을 받아와서 파싱하고

그 값을 내가 원하는대로 수정해서 원래 GPS 데이터로 출력하는 건데..

 

괜찬아 보이는데 쓰기 쉬울려나?

 

 

Features
  • Most common NMEA messages fully supported
    • GNSS: BOD, GGA, GLL, GNS, GSA, GST, GSV, RMB, RMA, RMB, RMC, RTE, VTG, ZDA
    • Garmin Proprietary: PGRME, PGRMZ
    • Trimble Laser Range Finder: PTNLA, PTNLB
    • TruePulse Laser Range Finder: PLTIT
  • Automatic merging of multi-sentence messages for simplified usage.
  • Extensible with custom NMEA messages see here
  • Multiple input devices out of the box
    • System.IO.Stream (all platforms)
    • Emulation from NMEA log file (all platforms)
    • Serial Device: .NET Framework, .NET Core (Windows, Linux, Mac) and Windows Universal.
    • Bluetooth: Windows Universal and Android. .NET Core/.NET Framework is supported using the bluetooth device via the SerialPortDevice.

[링크 : https://www.nuget.org/packages/SharpGIS.NmeaParser/]

[링크 : https://dotmorten.github.io/NmeaParser/api/index.html]

'Programming > c# & winform' 카테고리의 다른 글

c#에서 ini 파일 사용하기  (0) 2020.11.05
C# UTC -> 지역시간  (0) 2020.11.05
c# label rotate  (0) 2020.11.04
c# tooltip  (0) 2020.11.04
c# GIF picturebox  (4) 2020.11.04
Posted by 구차니
Programming/c# & winform2020. 11. 4. 20:42

일일이 돌리려면 죽어 나겠는데 편하게 돌리는 법 없나?

 

[링크 : https://www.codeproject.com/Questions/1103814/How-to-rotate-a-label-by-keeping-autosize-in-Cshar]

[링크 : https://www.c-sharpcorner.com/forums/rotate-a-lable-in-c-sharp]

 

 

+ 2020.11.05

문자열이 얼마나 크게 그려지는지 pixel 단위로 돌려받는 함수.

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.drawing.graphics.measurestring?view=dotnet-plat-ext-3.1]

 

+ 2020.11.05

4분면 마다 다르게 설정해야 하는데 sin/cos 다시 공부하게 생겼다.. ㅠㅠ

아무튼 해당 코드 정상적으로 잘 작동하는 것 확인!

[링크 : https://stackoverflow.com/questions/1371943/c-sharp-vertical-label-in-a-windows-forms]

'Programming > c# & winform' 카테고리의 다른 글

C# UTC -> 지역시간  (0) 2020.11.05
c# gps(nmea parser)  (0) 2020.11.05
c# tooltip  (0) 2020.11.04
c# GIF picturebox  (4) 2020.11.04
C# 큰 이미지를 일부만 그리고 드래그 지원하기  (2) 2020.10.30
Posted by 구차니
Programming/c# & winform2020. 11. 4. 18:16

ToolTip.IsBalloon = true;

 

ToolTip.IsBalloon = false;

 

[링크 : https://stackoverflow.com/questions/9776077/how-can-i-add-a-hint-or-tooltip-to-a-label-in-c-sharp-winforms]

[링크 : http://www.gisdeveloper.co.kr/?p=2244]

Posted by 구차니