반응형
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DzERD.CustomControls.Common
{
    public class ImageButtonER : Button
    {

        Image _click;
        Image _nomal;
        Image _hover;
        Image _disable;



        public Image Click1
        {
            get { return _click; }
            set { _click = value; }
        }

        public Image Hover
        {
            get { return _hover; }
            set { _hover = value; }
        }

        public Image Nomal
        {
            get { return _nomal; }
            set { _nomal = value; }
        }
        public Image Disable
        {
            get { return _disable; }
            set { _disable = value; }
        }


        public ImageButtonER()
        {
            this.BackColor = Color.Transparent;
            this.BackgroundImageLayout = ImageLayout.Stretch;
            this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            if (this.Nomal != null)
            {
                this.BackgroundImage = Nomal;

            }
            this.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255);

        }

        protected override bool ShowFocusCues
        {
            get
            {
                return false;
            }
        }

        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            this.BackgroundImage = Hover;
        }

        protected override void OnLostFocus(EventArgs e)
        {
            base.OnLostFocus(e);
            this.BackgroundImage = Nomal;
        }

        protected override void InitLayout()
        {
            base.InitLayout();
            if(this.Nomal != null)
            {
                this.BackgroundImage = Nomal;
            }
        }

        protected override void OnMouseHover(EventArgs e)
        {
            this.BackgroundImage = _hover;
            this.Refresh();
        }

        protected override void OnMouseEnter(EventArgs e)
        {
            this.BackgroundImage = _hover;
            this.Refresh();
        }

        protected override void OnMouseUp(MouseEventArgs mevent)
        {
            this.BackgroundImage = _hover;
            this.Refresh();
            base.OnMouseUp(mevent);
        }

        protected override void OnMouseDown(MouseEventArgs mevent)
        {
            this.BackgroundImage = _click;
            this.Refresh();
            base.OnMouseDown(mevent);
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            this.BackgroundImage = _nomal;
            this.Refresh();
        }

        protected override void OnEnabledChanged(EventArgs e)
        {
            if (this.Enabled)
            {
                this.BackgroundImage = _nomal;
            }
            else
            {
                this.BackgroundImage = _disable;
            }

            base.OnEnabledChanged(e);
        }

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            base.OnPaintBackground(pevent);
        }

    }
}
반응형
            PropertyDescriptor descriptor = TypeDescriptor.GetProperties(this.GetType())["속성이름"];

            BrowsableAttribute attrib = (BrowsableAttribute)descriptor.Attributes[typeof(BrowsableAttribute)];

            FieldInfo isBrow = attrib.GetType().GetField("browsable", BindingFlags.NonPublic | BindingFlags.Instance);

            isBrow.SetValue(attrib, True or False);

'Programing > C# ' 카테고리의 다른 글

showWindow 에서 TopMost로 폼창 띄우기  (0) 2014.04.21
Custom Button for Image  (0) 2014.04.03
한글입력 구분  (0) 2014.03.26
Graphics Text Rotate 글자 회전  (0) 2013.12.18
point , inch, pixel ,mm 단위 관계  (0) 2013.12.11
반응형
#region ImportDLL
[DllImport("Imm32.dll", SetLastError = true)]
public static extern IntPtr ImmGetContext(IntPtr hWnd);
[DllImport("imm32.dll")]
public static extern bool ImmGetConversionStatus(IntPtr himc, ref int lpdw, ref int lpdw2);
[DllImport("imm32.dll")]
public static extern bool ImmGetOpenStatus(IntPtr himc);
private Byte IME_CMODE_HANGEUL = 0x0001;
#endregion


  protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            //ime가 한글일경우 바로 editMode로 들어가도록 한다.  textbox입력 모드로 하기위해서
            int iMode = 0;
            int iSentence = 0;
            IntPtr HIme = ImmGetContext(this.dataGridViewUpload.Handle);
            bool bSuccess = ImmGetConversionStatus(HIme, ref iMode, ref iSentence);

            if (ImmGetOpenStatus(HIme))
            {

                if ((iMode & IME_CMODE_HANGEUL) > 0)
                {


                    if (!((keyData & Keys.Control) == Keys.Control))
                    {

                        switch (keyData)
                        {
                            case Keys.Up:
                            case Keys.Down:
                            case Keys.Left:
                            case Keys.Right:
                                break;
                            default:
                                dataGridViewUpload.BeginEdit(true);
                                break;
                        }

                    }
                }
            }

            if (keyData == Keys.Enter)
            {

                if (this.dataGridViewUpload.CurrentCell != null
                    && this.dataGridViewUpload.CurrentCell.IsInEditMode
                    && !(this.dataGridViewUpload.CurrentCell is DataGridViewCheckBoxCell))
                {
                    MoveNextCell();
                }
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
반응형
     
      using (Matrix matrix = new Matrix())
            {
  
                matrix .RotateAt(90f ,new PointF(원점)); 
               e.Graphics.MultiplyTransform(matrix );
               e.Graphics.DrawString("TestString", this.Font, Brushes.Black, 100, 100);
                matrix .Invert();
                e.Graphics.MultiplyTransform(matrix );

            }

+ Recent posts