전체 글 411

C# 리스트 박스 수직 스크롤바 없애기

프로젝트내에 클래스를 추가 하던, 라이브러리 형태로 하던 간에, 아래 코드로 리스트 박스를 재정의 해서 쓰면 수직 스크롤바가 사라짐. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace ClassLibrary1 { public class MyListBox : System.Windows.Forms.ListBox { private bool mShowScroll; protected override System.Windows.Forms.CreateParams CreateParams { get { CreateParams cp = base.Crea..

개발/C# 2019.12.20

C# 비디오 레코딩 소스 코드

mpeg 동영상을 만들어주는 소스 코드. 영상을 10 프레임 비율로 쪼개서 캡쳐저장뒤, 오디오랑 합체 시켜 mpeg 파일을 만듬. reference 에서 참조해야할 dll 은 Accord.Video.FFMPEG 자세한 내용은 블로그 참조. https://benbcompsci.wordpress.com/2018/12/04/c-screen-recorder/ [C#] Screen Recorder App In this post I will be going over how to make a screen recorder app using C#. The first thing you need to do is install FFMPEG to your system, which you can do by following th..

개발/C# 2019.11.27

C# <이벤트> 통신(Uart,CAN 등) 에서 실시간 값전달

Form1.cs private Initial() { Manager = new Manager(); Manager.RXMsgEvent += ReadCANMEssage; // event 생성 } private void ReadCANMEssage(object sender, TPCANMsgFD e) // 이벤트 발생시 처리할 함수 { if (InvokeRequired) { Invoke(new EventHandler(ReadCANMEssage), sender, e); } else { if(e.ID == 0x18FF02EB) { MessageBox.Show("Test"); } } } CAN.cs public event EventHandler CANRxMsgEvent; // 이벤트 설정 private void Read..

개발/C# 2019.09.30

C# contextmenustrip Control 찾기

ContextmenuStrip 한개로 여러 Control Listview 나 Listbox 같은 곳에 공통적으로 사용하려고 할때 현재 컨트롤러를 알아야 할 필요가 없다. 모르면.. 여러개를 만들어야 하니까. 그런 무식한 설계는 이제 그만 이럴때 sender 로 Toolstripitem 으로 as 한뒤 그것의 Owner를 찾으면 현재 어느 컨트롤에서 클릭하여 Contextmenustrip 이 사용되어 있는지 알수 있다.. 그것이 바로 아래 코드에서 sourceControl 이고 이것이 Listview 이면 as로 처리하면 된다.. ListView listview = null; ToolStripItem menuItem = sender as ToolStripItem; if (menuItem != null) {..

개발/C# 2019.07.12

C# 패널 스크롤바 키보드로 움직이기

Form 안에 패널이 있고 이 패널 안에 Picture 박스가 있다고 치자. 이 Picture 박스의 그림이 패널 보다 크면 스크롤이 생기는데 키보드를 이용해서 내리고 싶을때가 있다. 이럴때 아래 코드를 사용하면 된다. Form에서 Keydown 이벤트를 발생시키고 키다운 /업 에따라 처리하면 된다. private void Form1_KeyDown(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.Down) { Point current = panel_command.AutoScrollPosition; Point scrolled = new Point(current.X, -current.Y + 50); panel_command.AutoScrollPosition =..

개발/C# 2019.07.09