Search Results

Search found 3 results on 1 pages for 'istrebitel'.

Page 1/1 | 1 

  • Precise exposition of an image for set number of frames (Vsync?)

    - by Istrebitel
    I need to make a simple enough program in C#, but it seems to be impossible via usual WinForms means. I need to show something (a string of text, an image) on the screen for very small time interval. Since typical monitors are 60Hz, this interval would be 1 or 2 frames (16,6 or 33,3 ms). I tried doing this with usual WinForms, and it is not possible because, apparently, there is no way to know how many frames were output to the monitor since some point in time. I can only draw on the controls, and monitor output is totally independant. So even if I run the timer, say, for 17 ms, between showing and hiding the image, it still sometimes manages not to draw a single frame of my image on the screen (even though theoretically it should, because 17ms 16,6ms). Moreover, even 20ms seems to slow (even though i should be more than enough). I did some game development as a hobby in the past (Delphi X, XNA) and I know that you usually draw the whole screen by yourself, each frame. Also, I know that there is an option called Vsync in most modern games, that allows you to synchronize your framerate to your monitor's frame rate. So, is it possible? I mean, to actually know how many frames were sent to the monitor with w/e I want to show?

    Read the article

  • need to change TextBox.Text inside TextChanged, something forces form close

    - by Istrebitel
    I am making a TextBox behave like if it could store a null value. In order to do that, i have a variable NullMode that indicates wether the value is stored is Null, and in TextChanged i set that to false, and on specific user action i set it to true and Text to a value that indicates that there is null inside the textbox. Then, based on NullMode, textbox is drawn differently. Now, i have a semaphore-like approach in order to prevent event handle from firing when i dont need it. Here is how it looks: private void input_TextChanged(object sender, EventArgs e) { if (_preventTextBoxEvents) return; _preventTextBoxEvents = true; //if (NullMode) // Text = ""; NullMode = false; ValidateInput(); _preventTextBoxEvents = false; } Now, if i need to set a textbox text to something that should show while in nullmode, i just set _preventTextBoxEvents before i do to true and it works all right. BUT! I need to also remove the text when user tries to input something into the textbox! So i need to set Text to "". Problem is, if i uncomment that, form is closed after the event handler exits. I cannot prevent it (e.Cancel = true in FormClosing doesnt help!) and do not understand what can be causing it. There is no error message too (and i'm not doing try-catch). My logic, when i do Text="". OnTextChanged should fire, it should call my TextChanged and it will see _preventTextBoxEvents is true and exit, so there would be no stack overflow / infinite recursion. What is going on?

    Read the article

  • Is there a way to make XmlDocument parsing less strict

    - by Istrebitel
    I am making a program that will store its data in an XML file. When people write XML they can make subtle mistakes, like ending a comment with - so it looks like <!-- comment ---> or adding a </>inside an attribute. Naturally, the XML still can be read all right, but trying to input this text into XmlDocument will give a syntax error (and it wont be parsed). Is there a way to make XmlDocument less strict and make it ignore violations of the standard that do not make the document unparseable? For example, its clear that <!-- comment ---> is still a comment even though it contains - at the end which is against the standard specification).

    Read the article

1