Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have created a simple paint application in VC# 2008 with the help of a YouTube video. Its code is as here:
http://paste.pocoo.org/show/268704/
The problem with the code is that if I draw something in the picturebox, minimize the application, and thn maximize it, whatever I had drawn, disappears. The picturebox becomes clear. Why is it so? Plz help me.
You should be doing your painting during the Paint event. This event completely redraws the image. So when you un-minimize the application, the image is redrawn and you don't do anything.
Your application needs to store information about what has been drawn so that it can be redrawn. This is an example of the Model-View-Controller model. The PictureBox is the viewer, the stored information is the model and mouse event listeners will be part of the controller that can make alterations to the model.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I'm following an online course and then I noticed that the buttons just stopped working.
Here are some images The Scene View, Game Over Canvas Components, Game Over Text Components, Restart Button Components(The Broken Button), Leave Text Components(The Other Broken Button), The Script That Have Something to do with the canvas.
I've tried multiple solutions on the internet and nothing works and I think I didn't mess with anything else but the colors and the text in the button. I just want the buttons to work like it's a button.
your EventSystem Object maybe deleted or disabled, try to recreate it:
It will created automatically when you create UI/Canvas:
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I know this question is short but there is nothing to say.
I found a nice html effect:
https://codepen.io/jkiss/pen/OVEeqK
Links to codepen.io must be accompanied by code
Can someone implement this in a borderless maximized winforms application?
Im not very good at programming in this kind. I hope somebody can help me.
(I made the assumption you wanted to write C# code instead of the HTML/css/js, and not host HTML in a WinForms application. Let me know if I was wrong)
Even though I think this question is way too broad for SO, here are some starting points:
in WinForms you can paint on a form by overriding its OnPaint method
if you clear the entire screen each frame in OnPaint, you should override OnPaintBackground and leave it empty
call SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true) in the constructor of the form to avoid flicker
the Graphics object that is provided for you in the OnPaint method can be used to draw lines and fill ellipses
to keep your application responsive while having a decent framerate, you can call Invalidate() in your OnPaint method. This is faster than using a timer (although you won't get a constant framerate).
If you run into specific questions, SO is definitely the right place to go.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
i have created an application using C# that has some forms with a lot of pictures and text. The problem is that the background image seems to be affecting the performance. it looks like processing or rendering to load the form and its noticeable even at a run time.
i already tried changing the background image but still it has that rendering look. i tried removing the entire background image and it runs smoothly without it.
i captured my screen here's a Link
As per #Taw,
This link explains form double buffering for your C# application.
It allows you to write to an off-screen buffer to prevent flickering and other graphical corruption from occuring while writing directly to a form. It is a very common technique in game and graphics development to allow very complex images to be created while prevent tearing, shearing, and other fun side effects that you can check out when you get a chance.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a win forms application. The form contains a third party chart from dotnetcharting. The form also has a few other controls which allows the user to select the type of chart they wish to see.
The issue I have is when the user clicks the button to plot the chart nothing appears to happen (it is though), so the chart is blank. However when I go to another application, a word document, or web page or whatever and then go back to my win forms application the chart now appears. Why is this?
Is this to do with win forms or the chart? Is there some refresh I need to do?
I think it has to do with the refreshing, please try to put the line:
Application.DoEvents();
after the data is being updated. It should then change the form.
Difficult to say without more information.
Sounds like you have to invalidate the control which sounds odd for a third party control.
Possibly there is a function on the control to tell it to redraw or that you are finished with calculating. Did you check the documentation on usage?
Some controls can be paused from updating the UI to let them handle lots of data and restarted after you finished with the data.
Post some more info on usage and code
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a winforms app I align the controls so that the look like picture 1. When I compile, a custom control resizes and repositions itself which is an undesirable effect. How can I stop this from happening. Autosize is set to false on everything.
Before compile: Correct.
After compile: Incorrect.
The picture is misleading. The form stays the same dimensions. It's the custom control that is changing size.
I had the exact same problem, controls resizing itself to the size of even 0,0 after every rebuild, wich got quite annoying after a while.
After searching through SO i found the solution in Rich his reply on a question similair to this: Click here
Basicly, when you set your Form's Autoscale property to None, this problem will dissapear.
Enjoy :)
Check the Anchor property of the textbox or label in the custom control