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.
Related
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 2 years ago.
Improve this question
I want to display another application's window that is running concurrently in my WPF application. Like a live display, I need to be able to see real-time changes to the window (in this case, Chrome's) even if it is hidden behind other windows while my WPF application is running. It's kind of like the image below:
I understand I have to get the window's handle first, but how would I be able to display an external window like this? Is there a way I can use the Win32 API for this function?
Try looking into the Frame element (documentation here).
<Frame Source="https://www.google.com"/>
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 3 years ago.
Improve this question
I am doing Coloring Game. Where i am doing coloring the picture. I have done that. But i have to undo the color . It should revert back .
For eg: windows paint. Draw and Undo Same Feature. can any one can post sample code.
This is a very broad topic. There are many ways to solve this.
For pixel-based drawing (as opposed to vector-based), the most straightforward method is to save a copy of the image before each drawing operation. ("Save" in this case means make a copy in memory, not write it to disk.) To undo an operation, revert to the previous version of the image. Even "large" images these days are relatively small compared to the amount of RAM available on a typical machine. Keeping a list of, say, 20 images, giving 20 undo steps, shouldn't be a problem.
For vector-based drawing, keep a List<> of objects as they are drawn. To undo, delete the last object that was added.
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 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 8 years ago.
Improve this question
I have a question regarding problem i am solving. I am editing an old Winform app; currently the only part I need does not take input from the user(automated program). However the form contains database connection settings that program uses. Currently the program needs the user to press a button to start the process (code is associated with the button). Do i need to convert whole app to Console App or is there an easier way to automate this process without messing with the database connection settings.
Right now, you have a WinForm that runs code on a button press. You need to turn this into a "headless" or automatic process. Here is what I think based on your description would be the best things to do:
Remove the button, and have the code that was being ran by the button be called by a more "automatic" process, such as "Form_Load" or a timer.
Take the code and move it into a console app. As long as you don't ask for user input within the logic, it will run and close itself when it's done.
However, this is just some broad and generic suggestions. You need to look at your code and decide for yourself what to do.
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.