gFinger 손끝으로 만드는 세상

사상이나 환경이 서로를 미워하게 만들었지만,
세월이 지난 지금 그것을 어떻게 보듬고 치료해야 할까?
이제는 사상이 다른 국가도 서로 교역과 교류를 하지만 그 시절의 상처를 가진 사람은 영원히 그것을 잊지 못할 수 도 있을 수도 있고..
그럼에도 미래를 향해 가야 하고..

당시에 사람이 우선인 결정을 내린 이분의 이야기는 많은 생각을 하게 만든다.


출처 :  클리앙

https://m.clien.net/service/board/park/12207087

기사 링크
http://shindonga.donga.com/3/all/13/104148/1


Text File Save Dialog


       SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "Save License File";
            dlg.Filter = "lic Files (*.lic)|*.lic";
            dlg.FileName = Application.StartupPath + "\\..\\..\\ssPlcADS.lic";
            if (dlg.ShowDialog() != DialogResult.OK) return;
            try
            {
                var sr = new System.IO.StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8);
                //Write the header
                sr.WriteLine(textBoxKey.Text);
                sr.Close();
            }
            catch
            {
                MessageBox.Show("Can't Write Key File");
            } 



File Name을 선택해서 Text 파일 읽기


            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open License File";
            dlg.Filter = "License File (*.lic)|*.lic";
            dlg.FileName = Application.StartupPath + "\\..\\..\\" + filename;

            string ActivationKey;
            if (dlg.ShowDialog() != DialogResult.OK) return false;
            try
            {
                System.IO.StreamReader ObjReader = new System.IO.StreamReader(dlg.FileName);
                ActivationKey = ObjReader.ReadLine();
                ObjReader.Close();
            }
            catch (Exception ex) //General exception
            {
                MessageBox.Show(ex.Message);
                return false;
            } 


'컴퓨터 이야기 > c#' 카테고리의 다른 글

visual studio 빌드 후 이벤트  (0) 2018.11.29
Text File Save Dialog  (0) 2018.06.09
How to move and resize a form without a border?  (0) 2018.06.09
Form을 Drag해서 이동  (0) 2018.06.09
Program 2번 실행 방지  (0) 2018.06.06




- Form의 BorderStyle을 Node으로 하면 Border가 사라진다.
- 그러면 Resize 기능도 사라진다.
- 이런 경우 Grip을 실시간 추가 하고 OnPaint로 그려주면 Resize Grip을 이용 Resize가 가능하다.
- 단, Form을 다른 콘트롤이 꽉 채우게 되면 Resizing Grip이 Background로 그려지기 때문에 보이지를 않으므로 주의한다.

출처 :



        public FormMain()
        {               

            InitializeComponent();

            this.FormBorderStyle = FormBorderStyle.None;
            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.ResizeRedraw, true);
        }
        private const int cGrip = 16;      // Grip size
        private const int cCaption = 32;   // Caption bar height;

        protected override void OnPaint(PaintEventArgs e)
        {
            Rectangle rc = new Rectangle(this.ClientSize.Width - cGrip, this.ClientSize.Height - cGrip, cGrip, cGrip);
            ControlPaint.DrawSizeGrip(e.Graphics, this.BackColor, rc);
            rc = new Rectangle(0, 0, this.ClientSize.Width, cCaption);
            e.Graphics.FillRectangle(Brushes.DarkBlue, rc);
        }

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x84)
            {  // Trap WM_NCHITTEST
                Point pos = new Point(m.LParam.ToInt32());
                pos = this.PointToClient(pos);
                if (pos.Y < cCaption)
                {
                    m.Result = (IntPtr)2;  // HTCAPTION
                    return;
                }
                if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip)
                {
                    m.Result = (IntPtr)17; // HTBOTTOMRIGHT
                    return;
                }
            }
            base.WndProc(ref m);
        }
        /////////////////////////////////////////// 


'컴퓨터 이야기 > c#' 카테고리의 다른 글

Text File Save Dialog  (0) 2018.06.09
File Name을 선택해서 Text 파일 읽기  (0) 2018.06.09
Form을 Drag해서 이동  (0) 2018.06.09
Program 2번 실행 방지  (0) 2018.06.06
Tray로 Form을 Icon화 하기  (0) 2018.06.06

 


        /// <summary>
        /// Form을 Drag 해서 이동
        /// </summary>
        public const int WM_NCLBUTTONDOWN = 0xA1;
        public const int HT_CAPTION = 0x2;

        [DllImportAttribute("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
        [DllImportAttribute("user32.dll")]
        public static extern bool ReleaseCapture();

        // Main Form을 마우스로 잡고 이동
        private void FormMain_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();  
                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }
        }

        // menu Strip 부분을 마우스로 잡고 이동
        private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }
        }


'컴퓨터 이야기 > c#' 카테고리의 다른 글

Text File Save Dialog  (0) 2018.06.09
File Name을 선택해서 Text 파일 읽기  (0) 2018.06.09
How to move and resize a form without a border?  (0) 2018.06.09
Program 2번 실행 방지  (0) 2018.06.06
Tray로 Form을 Icon화 하기  (0) 2018.06.06