picturebox

Unusual dragging issue

£可爱£侵袭症+ 提交于 2019-12-24 07:36:10
问题 I've got a Picturebox, which the user can drag up or down. The program in question is a complex music staff editor for a piano, and thus the only way to achieve the moving of notes on a staff is with a number of if-statements and by modifying co-ordinates. The issue is that the user is unable to move the PictureBox component down, but when the object is dragged up, nothing happens. The class inherits from PictureBox. I would just like to emphasise that the PictureBox works when dragged

Draw Rectangle over PictureBox

爷,独闯天下 提交于 2019-12-24 07:27:21
问题 The next code lets you draw Rectangles in the Form with mouse clics. Why not, or how can be draw over a PictureBox? Public Class Form1 Dim SelectRect As Rectangle = New Rectangle() Dim ps As Point = New Point() Dim pe As Point = New Point() This catch the first click, starting point or corner of the rectangle Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown SelectRect.Width = 0 SelectRect.Height = 0 SelectRect.X = e.X

C# graphics, paint, picturebox centering

陌路散爱 提交于 2019-12-24 07:18:14
问题 Ok, so this is the problem: in C# forms I've created a new private void: private void NewBtn(string Name, int x, int y) Which has a purpose of creating a picturebox that imitates behavior of a button (don't ask why, I simply enjoy complicating things) and can be called as many times as I want. Font btnFont = new Font("Tahoma", 16); PictureBox S = new PictureBox(); S.Location = new System.Drawing.Point(x, y); S.Paint += new PaintEventHandler((sender, e) => { e.Graphics.TextRenderingHint =

Draw lines on a picturebox using mouse clicks in C#

强颜欢笑 提交于 2019-12-24 07:07:50
问题 I'm trying to make a program that will draw lines over a picturebox using mouse clicks for the locations of where the line is to be drawn from and to. This is my current code: public partial class Form1 : Form { int Drawshape; private Point p1, p2; List<Point> p1List = new List<Point>(); List<Point> p2List = new List<Point>(); public Form1() { InitializeComponent(); pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height); } private void button1_Click(object sender, EventArgs e)

C# ImageBox Clear Rectangle on MouseUp

风格不统一 提交于 2019-12-24 05:14:08
问题 I have a panel with multiple picturebox created at runtime. The user will create a rectangle on any picture box and the selected part will be displayed on a preview picturebox. I have successfully done the above using the below code. Question I want to clear the selection rectangle at mouseup event. Used invalidate but not working. From how to clear the graphics(rectangle shape) in picturebox Also, when I scroll the panel the same rectangle(mouse selection) is shown on all picturebox. private

move button along with picturebox vb/c#

时光毁灭记忆、已成空白 提交于 2019-12-23 15:37:30
问题 I am working on a mapped DVR/cctv UI. I made it myself, so I did not use google's API. I just cut off big part of the map where I need it. so, if I do have a really big map, then it won't fit in my pc's resolution, I haven't found a code to move the picture inside the pictureBox, but what I did is to move the pictureBox inside a panel. then it looked like a map, with boundaries. :) now, I want to be able to save/attach this button to the picture.. so whenever and wherever I move the

WindowsForm PictureBox.Image is null even though there's an image shown in the form

我与影子孤独终老i 提交于 2019-12-23 10:06:31
问题 I'm trying to capture the finger print scanned by this device-> http://www.nitgen.com/eng/product/finkey.html I'm able to scan the fingerprint and save the binary data successfully. I'm also able to display the fingerprint in the picture box. However when I'm trying to save the fingerprint displayed in the picture box, I'm getting an error that the Image of the picturebox is null. Below is my code of capturing the fingerprint and saving the image from the picturebox. public class Form1 :

C# how to get a bitmap from a picturebox

雨燕双飞 提交于 2019-12-23 07:51:50
问题 I have a image in picturebox. I want to get that image as a Bitmap. My one line code is: Bitmap default_image = (Bitmap)pictureBox5.Image.Clone(); But what i am getting is: default_image value=null; Can anyone help me. 回答1: Bitmap default_image = new Bitmap(pictureBox5.Image); You are never instantiating a Bitmap which is why it is null . 回答2: If you got the image into the PictureBox by using imageLocation pbSourceImage.ImageLocation = openFile.FileName; then PictureBox.Image will be null.

open the image in windows photo viewer by clicking on picturebox1 c#

浪尽此生 提交于 2019-12-23 05:41:49
问题 I have a project with SQlite database . I save images in folder " pics " ( into debug folder) & their name in the database ( column "docpic") . When I click in a row , related image retrieve the image from database to picturebox1 . i want open the image ( in picturebox1 ) by windows photo viewer by clicking on picturebox1 . how can do this ? i use this codes in picturebox1 click event but thats not work : if (pictureBox1.Tag != null) { System.Diagnostics.Process imageViewerProcess = new

Simple and fast real-time graphics for C# computer game (WinForms)

让人想犯罪 __ 提交于 2019-12-23 03:48:06
问题 I'm trying to make an integer array and Bitmap work in harmony as part of a C# winforms project for fast PictureBox editing (avoiding the slow SetPixel command). I added a Button and a PictureBox, a click event on the aformentioned Button and a closing event on the Form. The code for the Form is now like so: public partial class Form1 : Form { uint[] _Pixels { get; set; } Bitmap _Bitmap { get; set; } GCHandle _Handle { get; set; } IntPtr _Addr { get; set; } public Form1() {