목록공부/c# (3)
잉여의 즐거운 잉여 생활
static void CreateDatabase() { // Check if database exists bool dbExists = false; string dbName = "db_name"; try { using (NpgsqlConnection connection = new NpgsqlConnection(connectionString)) { connection.Open(); using (NpgsqlCommand command = new NpgsqlCommand($"SELECT 1 FROM pg_database WHERE datname='{dbName}'", connection)) { object result = command.ExecuteScalar(); dbExists = result != null..
private Point start_p; // 클릭시 마우스 위치 private Point end_p; // 마우스 이동할때 위치 private bool mouse_move = false; // 마우스가 드레그 상태인지 확인 /// /// 마우스 이동 이벤트 /// /// /// private void Object_MouseMove(object sender, MouseEventArgs e) { Point th; if (objmove) { // 마우스의 현재위치를 계산하기 위한 폼의 위치 if (mouse_move) { th = this.Location; end_p = ((Control)sender).PointToScreen(new Point(e.X, e.Y)); Point tmp = new Point((..
PictureBox 위에 라벨을 올려서 사용하는 경우가 있었고 라벨의 백그라운드를 투명하게 해야했었다 인터넷 검색결과 Color값에 Transparent를 설정하면 투명화 된다고 해서 넣어보았더니 투명하게 되는것이 아니고 흰색 배경으로 변경이 됐다. 이상이 있어 검색을 더 해본 결과 c#디자이너 쪽에서 변경을 해야 투명해 진다고 하드라 // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Controls.Add..