달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
반응형
Posted by 유령회사
|
반응형

   생성자에서 생성자 호출하고 싶을때는 위 이미지처럼

   원하는 생성자에 : this( 파라메타 ) 이런식으로 적어 주면된다.

Posted by 유령회사
|
반응형

String 짤라서 쓰는거보다 SimpleDateFormat 이놈 쓰는게 더 편하네요.

 

소스코드

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateConvert {

	public static void main(String[] args) {
		
		String strDate = "20200101";
				
		SimpleDateFormat sf = new SimpleDateFormat();
				
		try {
			
			// String -> Date로 형변환
			sf.applyPattern("yyyyMMdd");
			Date dt = sf.parse(strDate);

			// Date -> String로 형변환
			sf.applyPattern("yyyy-MM-dd");					
			System.out.print(sf.format(dt));
			
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
}

 

SimpleDateFormat 패턴표

기호 의미 출력
G 연대(BC,AD) AD
y 년도 2012
M 월(1~12월) 7
w 년의 몇 번째 주(1~53) 28
W 월의 몇 번째 주(1~5) 2
D 년의 몇 번째 일(1~366) 194
d 월의 몇 번째 일(1~31) 11
F 월의 몇 번째 요일(1~5) 3
E 요일
a 오전/오후(AM,PM) PM
H 시간(0~23) 0
k 시간(1~24) 24
K 시간(0~11) 10
h 시간(1~12) 10
m 분(0~59) 22
s 초(0~59) 7
S 천분의 1초(0~999) 253
z Time zone(General Time Zone) GMT+9:00
Z Time zone(RFC 822 time zone) +0900

 

출력

 

'프로그래밍 > Java' 카테고리의 다른 글

[Java]ResultSet Row수 구하기  (0) 2018.09.18
[Java]BigDecimal 올림 반올림 버림  (0) 2018.08.04
[Java]Spring 한글설정  (0) 2018.07.09
[Java]String, StringBuffer, StringBuilder  (0) 2018.07.07
[Java] String.valueOf와 toString  (0) 2018.05.30
Posted by 유령회사
|
반응형

text-shadow 두세겹으로 겹치면 저런 효과가 난다고 하네요

'프로그래밍 > css' 카테고리의 다른 글

[CSS] Inner Rounding  (0) 2019.11.12
Posted by 유령회사
|
반응형

가운데 영역의 사각형을 Rounding처리 하는 방법이라고 하는데 outline이 rounding시키는 원보다 켜야 됨

'프로그래밍 > css' 카테고리의 다른 글

[css]빛나는 텍스트  (0) 2019.12.28
Posted by 유령회사
|
반응형

간단하게 만든 스포이드 툴

색상알려주는 정도만 만듬

기본적인 색상 선택은 스팩드럼에서 클릭하시면되고

컴퓨터화면에서 가져올때는 스포이드 버튼을 누른채 원하는 색상까지 드래그하여 주세요

 

처음에만 색상가져올때 약간 딜레이가 있는데 먼지 모르겠다...ㅜㅜ

 

실행파일

Release.zip
0.61MB

 

소스코드

WindowsFormsApp1.zip
1.89MB

'프로그래밍 > 자작프로그램' 카테고리의 다른 글

[자작프로그램]스샷프로그램  (0) 2019.06.13
Posted by 유령회사
|
반응형

http://csharphelper.com/blog/2019/07/draw-text-with-colors-reversed-in-its-upper-and-lower-halves-in-c/

 

 

private void Button1_Click(object sender, EventArgs e)
        {            
            DrawSplitText(this.pictureBox1.CreateGraphics()
                        , this.textBox1.Text
                        , new Font(this.textBox1.Font.FontFamily, 20, FontStyle.Bold)
                        , new Rectangle(this.pictureBox1.Location, this.pictureBox1.Size)
                        , new SolidBrush(Color.Black)
                        , new SolidBrush(Color.White));
        }

        // Draw split text centered in the indicated rectangle.
        private void DrawSplitText(Graphics gr,
            string text, Font font, Rectangle rect,
            Brush top_fg_brush, Brush bottom_fg_brush)
        {
            // Make bitmaps holding the text in different colors.
            Bitmap bm_top = new Bitmap(rect.Width, rect.Height);
            Bitmap bm_bottom = new Bitmap(rect.Width, rect.Height);

            // Make a StringFormat to center text.
            using (StringFormat sf = new StringFormat())
            {
                sf.Alignment = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;

                using (Graphics gr_top = Graphics.FromImage(bm_top))
                {
                    gr_top.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                    gr_top.FillRectangle(bottom_fg_brush, rect);
                    gr_top.DrawString(text, font, top_fg_brush, rect, sf);
                }

                using (Graphics gr_bottom = Graphics.FromImage(bm_bottom))
                {
                    gr_bottom.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                    gr_bottom.FillRectangle(top_fg_brush, rect);
                    gr_bottom.DrawString(text, font, bottom_fg_brush, rect, sf);
                }
            }

            // Fill the top and bottom halves of the rectangle.
            RectangleF top_rect = new RectangleF(
                rect.X, rect.Y, rect.Width, rect.Height / 2f);
            using (TextureBrush brush = new TextureBrush(bm_top))
            {
                gr.FillRectangle(brush, top_rect);
            }

            RectangleF bottom_rect = new RectangleF(
                rect.X, top_rect.Bottom, rect.Width, rect.Height / 2f);
            using (TextureBrush brush = new TextureBrush(bm_bottom))
            {
                gr.FillRectangle(brush, bottom_rect);
            }

            bm_top.Dispose();
            bm_bottom.Dispose();
        }
Posted by 유령회사
|
반응형
private Image ScaleImage(Image image, float scale)
{
	if (image == null) return null;

	int width = (int)(image.Width * scale);
	int height = (int)(image.Height * scale);

	Bitmap bm = new Bitmap(width, height);
	using (Graphics gr = Graphics.FromImage(bm))
	{
		gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
		Rectangle dest_rect = new Rectangle(0, 0, width, height);
		Rectangle source_rect = new Rectangle(0, 0, image.Width, image.Height);
		gr.DrawImage(image, dest_rect, source_rect, GraphicsUnit.Pixel);
	}

	return bm;
}

'프로그래밍 > C#' 카테고리의 다른 글

[ C#] 생성자에서 생성자 호출하기  (0) 2020.05.18
[C#]텍스트 배경 반반따로 그리기?  (0) 2019.07.17
[C#]듀얼 스크린 Capture  (0) 2019.06.11
[C#]OpenCvSharp 이미지 로드  (0) 2019.02.05
[C#] 둥근 버튼  (0) 2019.01.12
Posted by 유령회사
|
반응형

단축키 Ctrl + Q  활성화 프로그램

          Ctrl + W 화면지정(드래그)

 

※ 폼에서 닫기 버튼을 누르면 트레이상태로 넘어감

 

   클립보드 선택시 클립보드에 들어가고

   PNG 선택시 바탕화면으로 날짜시간순으로 바탕화면에 파일 생김

   

   프로그램 종료시에는 트레이 아이콘에서 우클릭 후 종료 선택

   

 

실행파일

Release.zip
0.16MB

소스파일

MyCapture.zip
0.85MB

'프로그래밍 > 자작프로그램' 카테고리의 다른 글

[자작프로그램]스포이드 툴  (0) 2019.09.26
Posted by 유령회사
|
반응형
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

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

        private void Button1_Click(object sender, EventArgs e)
        {
            Rectangle rc = new Rectangle();
            foreach (var item in Screen.AllScreens)
            {
                rc = Rectangle.Union(rc, item.Bounds);
            }

            Bitmap bmp = new Bitmap(rc.Width, rc.Height);
            using (Graphics g = Graphics.FromImage(bmp))
            {                
                g.CopyFromScreen(rc.Location, Point.Empty, bmp.Size);
            }
            bmp.Save(@"sshot.png", ImageFormat.Png);
        }
    }
}

'프로그래밍 > C#' 카테고리의 다른 글

[C#]텍스트 배경 반반따로 그리기?  (0) 2019.07.17
[C#]이미지 크기 변경  (0) 2019.06.23
[C#]OpenCvSharp 이미지 로드  (0) 2019.02.05
[C#] 둥근 버튼  (0) 2019.01.12
[C#]파일 확장자로 구분해서 image 저장  (0) 2018.12.15
Posted by 유령회사
|