'분류 전체보기'에 해당되는 글 159건

  1. 2009.03.20 5
  2. 2009.03.20 4
  3. 2009.03.20 3
  4. 2009.03.20 2
  5. 2009.03.20 1
  6. 2009.03.20 DB 형변환 방법
  7. 2009.03.19 Exam #1 검색 프로그램을 만들어 보자!
  8. 2009.03.19 2009년03월19일
  9. 2009.03.17 기본 Threading Study #2
  10. 2009.03.16 일단 스레딩 공부 참조 할 부분 링크
카테고리 없음2009. 3. 20. 14:56

5

public void DrawIcon(Graphics g, Image icon, Rectangle bounds, bool selected, bool enabled, bool ischecked)
        {
            // make icon transparent
            Color transparentColor = Color.FromArgb(0, 128, 128);
            Bitmap tempIcon = (Bitmap)icon;
            tempIcon.MakeTransparent(transparentColor);

            int iconTop = bounds.Top + (itemHeight - BITMAP_SIZE) / 2;
            int iconLeft = bounds.Left + (STRIPE_WIDTH - BITMAP_SIZE) / 2;
            if (enabled)
            {
                if (selected)
                {
                    ControlPaint.DrawImageDisabled(g, icon, iconLeft + 1, iconTop, Color.Black);
                    g.DrawImage(icon, iconLeft, iconTop - 1);
                }
                else
                {
                    g.DrawImage(icon, iconLeft + 1, iconTop);
                }
            }
            else
            {
                ControlPaint.DrawImageDisabled(g, icon, iconLeft + 1, iconTop, SystemColors.HighlightText);
            }
        }

        public void DrawSeparator(Graphics g, Rectangle bounds)
        {
            int y = bounds.Y + bounds.Height / 2;
            g.DrawLine(new Pen(SystemColors.ControlDark), bounds.X + iconSize + 7, y, bounds.X + bounds.Width - 2, y);
        }

        public void DrawBackground(Graphics g, Rectangle bounds, DrawItemState state, bool toplevel, bool hasicon, bool enabled)
        {
            bool selected = (state & DrawItemState.Selected) > 0;

            if (selected || ((state & DrawItemState.HotLight) > 0))
            {
                if (toplevel && selected)
                {   // draw toplevel, selected menuitem
                    bounds.Inflate(-1, 0);
                    g.FillRectangle(new SolidBrush(stripeColor), bounds);
                    ControlPaint.DrawBorder3D(g, bounds.Left, bounds.Top, bounds.Width,
                        bounds.Height, Border3DStyle.Flat, Border3DSide.Top | Border3DSide.Left | Border3DSide.Right);
                }
                else
                {   // draw menuitem hotlighted
                    if (enabled)
                    {
                        g.FillRectangle(new SolidBrush(selectionColor), bounds);
                        g.DrawRectangle(new Pen(borderColor), bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
                    }
                    else
                    {
                        // if disabled draw menuitem unselected
                        g.FillRectangle(new SolidBrush(stripeColor), bounds);
                        bounds.X += STRIPE_WIDTH;
                        bounds.Width -= STRIPE_WIDTH;
                        g.FillRectangle(new SolidBrush(bgColor), bounds);
                    }
                }
            }
            else
            {
                if (!toplevel)
                {   // draw menuitem, unselected
                    g.FillRectangle(new SolidBrush(stripeColor), bounds);
                    bounds.X += STRIPE_WIDTH;
                    bounds.Width -= STRIPE_WIDTH;
                    g.FillRectangle(new SolidBrush(bgColor), bounds);
                }
                else
                {
                    // draw toplevel, unselected menuitem
                    g.FillRectangle(SystemBrushes.Control, bounds);
                }
            }
        }

        public void DrawMenuText(Graphics g, Rectangle bounds, string text, string shortcut, bool enabled, bool toplevel, DrawItemState state)
        {
            StringFormat stringformat = new StringFormat();
            stringformat.HotkeyPrefix = ((state & DrawItemState.NoAccelerator) > 0) ? HotkeyPrefix.Hide : HotkeyPrefix.Show;

            // if 3D background happens to be black, as it is the case when
            // using a high contrast color theme, then make sure text is white
            bool highContrast = false;
            bool whiteHighContrast = false;
            if (SystemColors.Control.ToArgb() == Color.FromArgb(255, 0, 0, 0).ToArgb()) highContrast = true;
            if (SystemColors.Control.ToArgb() == Color.FromArgb(255, 255, 255, 255).ToArgb()) whiteHighContrast = true;

            // if menu is a top level, extract the ampersand that indicates the shortcut character
            // so that the menu text is centered
            string textTopMenu = text;
            if (toplevel)
            {
                int index = text.IndexOf("&");
                if (index != -1)
                {
                    // remove it
                    text = text.Remove(index, 1);
                }
            }

           

Posted by penguindori
카테고리 없음2009. 3. 20. 14:55

4

  // overrides
        // ---------------------------------------------------------
        protected override void OnMeasureItem(MeasureItemEventArgs e)
        {
            base.OnMeasureItem(e);

            // measure shortcut text
            if (Shortcut != Shortcut.None)
            {
                string text = "";
                int key = (int)Shortcut;
                int ch = key & 0xFF;
                if (((int)Keys.Control & key) > 0)
                    text += "Ctrl+";
                if (((int)Keys.Shift & key) > 0)
                    text += "Shift+";
                if (((int)Keys.Alt & key) > 0)
                    text += "Alt+";

                if (ch >= (int)Shortcut.F1 && ch <= (int)Shortcut.F12)
                    text += "F" + (ch - (int)Shortcut.F1 + 1);
                else
                {
                    if (Shortcut == Shortcut.Del)
                    {
                        text += "Del";
                    }
                    else
                    {
                        text += (char)ch;
                    }
                }
                shortcuttext = text;
            }

            if (Text == "-")
            {
                e.ItemHeight = 8;
                e.ItemWidth = 4;
                return;
            }

            bool topLevel = Parent == Parent.GetMainMenu();
            string tempShortcutText = shortcuttext;
            if (topLevel)
            {
                tempShortcutText = "";
            }
            //int textwidth = (int)(e.Graphics.MeasureString(Text + tempShortcutText, SystemInformation.MenuFont).Width);
            int textwidth = (int)(e.Graphics.MeasureString(Text + tempShortcutText, new Font("Tahoma", 9)).Width);
            int extraHeight = 4;
            e.ItemHeight = SystemInformation.MenuHeight + extraHeight;
            if (topLevel)
                e.ItemWidth = textwidth - 5;
            else
                e.ItemWidth = Math.Max(160, textwidth + 50);

            // save menu item heihgt for later use
            itemHeight = e.ItemHeight;
        }

        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (doColorUpdate)
            {
                DoUpdateMenuColors();
            }

            base.OnDrawItem(e);

            Graphics g = e.Graphics;
            Rectangle bounds = e.Bounds;
            bool selected = (e.State & DrawItemState.Selected) > 0;
            bool toplevel = (Parent == Parent.GetMainMenu());
            bool hasicon = Icon != null;
            bool enabled = Enabled;

            DrawBackground(g, bounds, e.State, toplevel, hasicon, enabled);
            if (hasicon)
                DrawIcon(g, Icon, bounds, selected, Enabled, Checked);
            else
                if (Checked)
                    DrawCheckmark(g, bounds, selected);

            if (Text == "-")
            {
                DrawSeparator(g, bounds);
            }
            else
            {
                DrawMenuText(g, bounds, Text, shortcuttext, Enabled, toplevel, e.State);
            }
        }

        public void DrawCheckmark(Graphics g, Rectangle bounds, bool selected)
        {
            int checkTop = bounds.Top + (itemHeight - BITMAP_SIZE) / 2;
            int checkLeft = bounds.Left + (STRIPE_WIDTH - BITMAP_SIZE) / 2;
            ControlPaint.DrawMenuGlyph(g, new Rectangle(checkLeft, checkTop, BITMAP_SIZE, BITMAP_SIZE), MenuGlyph.Checkmark);
            g.DrawRectangle(new Pen(borderColor), checkLeft - 1, checkTop - 1, BITMAP_SIZE + 1, BITMAP_SIZE + 1);
        }

Posted by penguindori
카테고리 없음2009. 3. 20. 14:52

3


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Text;

namespace SearchForm.Menu
{
    public partial class MenuItems : MenuItem
    {
        public MenuItems()
            : base()
        {
            InitializeComponent();
            OwnerDraw = true;
        }

        public MenuItems(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        static ColorGroup group = ColorGroup.GetColorGroup();
        static Color bgColor = group.bgColor;
        static Color stripeColor = group.stripeColor;
        static Color selectionColor = group.selectionColor;
        static Color borderColor = group.borderColor;

        static int iconSize = SystemInformation.SmallIconSize.Width + 5;
        static int itemHeight;
        static bool doColorUpdate = false;
        string shortcuttext = "";
        Bitmap icon = null;
        static int BITMAP_SIZE = 16;
        static int STRIPE_WIDTH = iconSize + 5;

      

        public MenuItems(string name, EventHandler handler, Shortcut shortcut)
            : this(name, handler)
        {
            this.Shortcut = shortcut;
        }

        public MenuItems(string name, EventHandler handler)
            : base(name, handler)
        {
            OwnerDraw = true;
        }

        public Bitmap Icon
        {
            get { return icon; }
            set { icon = value; }
        }

        public string ShortcutText
        {
            get { return shortcuttext; }
            set { shortcuttext = value; }
        }

        static public void UpdateMenuColors()
        {
            doColorUpdate = true;
        }

        private void DoUpdateMenuColors()
        {
            ColorGroup group = ColorGroup.GetColorGroup();
            bgColor = group.bgColor;
            stripeColor = group.stripeColor;
            selectionColor = group.selectionColor;
            borderColor = group.borderColor;
            doColorUpdate = false;
        }

      

Posted by penguindori
카테고리 없음2009. 3. 20. 14:51

2

<?xml version="1.0" encoding="utf-8" ?>
<MENUITEMS>
  <MENUITEM name="System">
    <MENUITEM name="Login" formName="Login" icon="" description=""/>
    <MENUITEM name="Logout" formName="Logout" icon="" description=""/>
  </MENUITEM>
  <MENUITEM name="File">
    <MENUITEM name="File열기" formName="Open" icon="" description=""/>
    <MENUITEM name="File저장" formName="Save" icon="" description=""/>
  </MENUITEM>
</MENUITEMS >
Posted by penguindori
카테고리 없음2009. 3. 20. 14:50

1

     ////Common.ChildForm form = null;

                    //try
                    //{
                    //    object obj = ass.CreateInstance(formName);
                    //    form = (Common.ChildForm)obj;
                    //}
                    //catch (System.InvalidCastException ex)
                    //{
                    //    MessageBox.Show(ex.Message);
                    //}

                    //if (form != null)
                    //{
                    //    form.Text = menuItem.Text;

                    //    form.Text = menuDescription.frmDescription;

                    //    // New Mdi Form Show
                    //    ShowMdiForm(form, form.Text, form.Text);
                    //}
                    //else
                    //{
                    //    MessageBox.Show("메뉴 준비중입니다.");
                    //}

Posted by penguindori
DataBase/MSSQL2009. 3. 20. 13:19
출처 : ORACLE의 TO_CHAR 함수를 MSSQL의 CONVERT 함수로

※ ORACLE에서 날짜를 처리할때는
TO_CHAR(SYSDATE,'YYYY-MM-DD') -> 2003-01-23
TO_CHAR(SYSDATE,'YYYY/MM/DD') -> 2003/01/23
TO_CHAR(SYSDATE,'YYYYMMDD') -> 20030123

※ 반대로 처리할때는 TO_DATE함수를 사용하면 되죠~

※ ORACLE에서 숫자를 처리할때는
TO_CHAR(2500000,'L9,999,999') -> w2,500,000
TO_CHAR(2500000,'9,999,999.99') -> 2,500,000.00

※ 반대로 처리할때는 TO_NUMBER함수를 사용하면 되죠~
※ 이 외에도 활용할 수있는 용도가 무지 많습니다.

※ MSSQL에서 날짜를 처리할때는
CONVERT(VARCHAR(10),GETDATE(),120) -> 2003-01-23
CONVERT(VARCHAR(10),GETDATE(),111) -> 2003/01/23
CONVERT(VARCHAR(8),GETDATE(),112) -> 20030123

※ MSSQL에서 숫자를 처리할때는
CONVERT(varchar(20),   convert(money,2500000),1) -> 2,500,000.00


출처 :
DBMS별 날짜 포맷변환

1. DBMS 별 시간, 날짜 조회 쿼리

Oracle

select sysdate from dual;  날짜+시분초 까지 조회가능
select current_timestamp from dual;  날짜+밀리초+시간존 까지 조회

MS SQL

select getdate()    날짜 + 밀리초 단위까지 조회가능

DB2 UDB

select current timestamp from sysibm.sysdummy1  날짜+밀리초까지 조회select current date from sysibm.sysdummy1  날짜만 조회
select current time from sysibm.sysdummy1  밀리초 단위시간조회



Posted by penguindori
Common C#/WinForm(C#)2009. 3. 19. 17:34
1. 디자인 Form

기본적인 Form 입니다.
위의 Form의 설정 화면 입니다.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SearchForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
}

아래 소스는 폼을 생성되면 자동으로 처음에 만들어 지는 부분 입니다.

namespace SearchForm
{
    partial class Form1
    {
        /// <summary>
        /// 필수 디자이너 변수입니다.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 사용 중인 모든 리소스를 정리합니다.
        /// </summary>
        /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form 디자이너에서 생성한 코드

        /// <summary>
        /// 디자이너 지원에 필요한 메서드입니다.
        /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
        /// </summary>
        private void InitializeComponent()
        {
            this.SuspendLayout();
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(570, 296);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Name = "MainForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "도리검색창 V1.0";
            this.ResumeLayout(false);
        }
        #endregion
    }
}




 위의 속성창에서 해당 굵은 글씨가 변경된 사항 입니다. 위와 같이 속성을 변경 하면 소스상에서는
  아래와 같이 지정이 됩니다.

// 아래는 폼의 스타일을 설정 합니다. [최대크기,최소크기,닫기] 창크기를 조정 할 수 없습니다.
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;

// 최초에 Form이 Load됐을때의 위치를 나타 냅니다. 아래는 화면의 가운데 표시 되도록 설정 합니다.
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Form 꾸미기

Posted by penguindori
2009/2009년 세우 일기2009. 3. 19. 17:20
--;
IT 시작 2006년8월달... 그후 2007년 4월달 ~9월달까지의 공백..
그후 2007년10월달부터 2009년 3월19일인 지금... 나는 새로운 출발을 하려고 한다.

2006년08월 ~ 2007년03월달 (시스템엔지니어 : 골든넷 소속) 8개월
2007년10월 ~ 2008년11월달 (프로그래머 : 유비샘 소속) 13개월  - C# 4개월 , Java(jsp/Servlet) 9개월
2008년12월 ~ 2009년03월달 (프로그래머 : 아이텍 소속)  4개월   - Java(jsp/Servlet) 4개월

Total : 25개월이다. 2년1개월... 많은 시간동안 열심히 일했던거 같다.

중간에 편의점에서 일을 하면서 일본어 학원도 다녔었고... 나름 노력은 했던것일까?..

신 전자여권(유비샘) -> Hynix 자동화팀(유비샘->아이텍) -> ??

자 인제는 솔루션 업체이다. 모바일... 우선 3월21일부터 출근이다. C#, C++ 열심히 한번 해보자.

오늘은 19일 D-Day2 남았다.

내나이 28살(만26살 생일 안지남 ^^;)

많이 힘겹고 앞으로도 그럴 것이지만.. 최선을 다하는 프로그래머가 되자.
Posted by penguindori
Common C#/C# Threading2009. 3. 17. 11:58

Posted by penguindori
카테고리 없음2009. 3. 16. 15:34
Posted by penguindori