I’m trying to create a simple csv file viewer in c# winforms. the problem is how to resize the usercontrol with the datagridview on form1 designer?
The code
Form with transparent element
In CSharp, on Windows 11, I have a form with a solid background and a transparent PictureBox. The form loads and PictureBox is actually transparent, but when I move the mouse over the transparent area the mouse handling gets sent to objects behind the form.
How to draw a point exactly on the mouse cursor coordinates?
this is a screenshot of my form1 and there is a small offset between the point and the mouse cursor. the point should be drawn where the mouse cursor arrow is.
Why getting exception System.IO.IOException: ‘The process cannot access the file … because it is being used by another process?
How to solve and avoid from getting this exception ?
How can the button color be changed using the method
namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public void Chose() { this.BackColor = Color.White; } private void F03_Click(object sender, EventArgs e) { Chose(); } } } I have a lot of buttons and when you click on any one it should change color. preferably through this (it […]
How to delete drawn points from image file?
I’m reading list of points from a json file and then draw the points on a file and then display the file with the drawn points. the problem is that if before loading i wad drawing points they will stay when loading. i need to clear the image file before drawing the points form the loading json. i’m not using paint event but Graphics for drawing on the image file.
How do I get my button to work on the first click?
In Winforms I have 72 buttons with images that are supposed toggle back and forth between different images when clicked, but I can’t find why the first click doesn’t make them toggle, all clicks after the first click seem to work as expected.
How to capture a screenshot including the mouse cursor in c# winforms when drawing a point on a pictureBox?
the problem is that no matter where and when i capture the screenshot it’s capturing it without the red point or a bit after the point has drawn and then the mouse cursor is no longer at the same position.
Why when drawing points on picturebox the last point gets deleted?
private void pictureBoxPoints_MouseDown(object sender, MouseEventArgs e) { if (pictureBoxPoints.Image != null) { pointCoordinates.X = e.X; pointCoordinates.Y = e.Y; // Convert point coordinates from pictureBoxPoints to original frame coordinates double xFactor = (double)pictureBoxPoints.Image.Width / pictureBoxPoints.Width; double yFactor = (double)pictureBoxPoints.Image.Height / pictureBoxPoints.Height; double xOffset = _convertedRectangle.X; double yOffset = _convertedRectangle.Y; int imageX = (int)(pointCoordinates.X * xFactor) + […]
Why when drawing points on picturebox the last point is get deleted?
private void pictureBoxPoints_MouseDown(object sender, MouseEventArgs e) { if (pictureBoxPoints.Image != null) { pointCoordinates.X = e.X; pointCoordinates.Y = e.Y; // Convert point coordinates from pictureBoxPoints to original frame coordinates double xFactor = (double)pictureBoxPoints.Image.Width / pictureBoxPoints.Width; double yFactor = (double)pictureBoxPoints.Image.Height / pictureBoxPoints.Height; double xOffset = _convertedRectangle.X; double yOffset = _convertedRectangle.Y; int imageX = (int)(pointCoordinates.X * xFactor) + […]