Click here to Skip to main content
15,904,416 members
Home / Discussions / C#
   

C#

 
Questionload image Pin
Arefeh Haghpnah4-Nov-09 3:13
Arefeh Haghpnah4-Nov-09 3:13 
AnswerCross post Pin
Not Active4-Nov-09 3:38
mentorNot Active4-Nov-09 3:38 
AnswerRe: load image Pin
Shameel4-Nov-09 4:06
professionalShameel4-Nov-09 4:06 
GeneralRe: load image Pin
Arefeh Haghpnah5-Nov-09 7:32
Arefeh Haghpnah5-Nov-09 7:32 
QuestionSendKeys in WebService Pin
Juergen Loewner4-Nov-09 2:16
Juergen Loewner4-Nov-09 2:16 
AnswerRe: SendKeys in WebService Pin
Dave Kreskowiak4-Nov-09 5:35
mveDave Kreskowiak4-Nov-09 5:35 
QuestionDealing with Lists as objects Pin
MatthysDT4-Nov-09 2:09
MatthysDT4-Nov-09 2:09 
AnswerRe: Dealing with Lists as objects Pin
Luc Pattyn4-Nov-09 2:34
sitebuilderLuc Pattyn4-Nov-09 2:34 
GeneralRe: Dealing with Lists as objects Pin
MatthysDT4-Nov-09 2:49
MatthysDT4-Nov-09 2:49 
GeneralRe: Dealing with Lists as objects Pin
Luc Pattyn4-Nov-09 4:05
sitebuilderLuc Pattyn4-Nov-09 4:05 
AnswerRe: Dealing with Lists as objects Pin
Shameel4-Nov-09 3:42
professionalShameel4-Nov-09 3:42 
QuestionRe: Dealing with Lists as objects Pin
MatthysDT4-Nov-09 18:51
MatthysDT4-Nov-09 18:51 
AnswerRe: Dealing with Lists as objects Pin
PIEBALDconsult4-Nov-09 3:56
mvePIEBALDconsult4-Nov-09 3:56 
QuestionGlass Effect using dwmapi.dll in windows xp on C# Pin
Viswa Teja4-Nov-09 2:01
Viswa Teja4-Nov-09 2:01 
AnswerRe: Glass Effect using dwmapi.dll in windows xp on C# [modified] Pin
Covean4-Nov-09 2:12
Covean4-Nov-09 2:12 
AnswerDumb attempt to bump post. Pin
Pete O'Hanlon4-Nov-09 2:41
mvePete O'Hanlon4-Nov-09 2:41 
AnswerRe: Glass Effect using dwmapi.dll in windows xp on C# Pin
Dave Kreskowiak4-Nov-09 5:20
mveDave Kreskowiak4-Nov-09 5:20 
Question[Windows Form with visual C#] - Problem with data conversion Pin
_ASPAle_4-Nov-09 1:12
_ASPAle_4-Nov-09 1:12 
AnswerRe: [Windows Form with visual C#] - Problem with data conversion Pin
OriginalGriff4-Nov-09 1:16
mveOriginalGriff4-Nov-09 1:16 
GeneralRe: [Windows Form with visual C#] - Problem with data conversion Pin
_ASPAle_4-Nov-09 2:17
_ASPAle_4-Nov-09 2:17 
AnswerRe: [Windows Form with visual C#] - Problem with data conversion Pin
Giorgi Dalakishvili4-Nov-09 1:19
mentorGiorgi Dalakishvili4-Nov-09 1:19 
AnswerRe: [Windows Form with visual C#] - Problem with data conversion Pin
Luc Pattyn4-Nov-09 2:37
sitebuilderLuc Pattyn4-Nov-09 2:37 
QuestionXNA: Game updating slowly Pin
jdneul4-Nov-09 1:06
jdneul4-Nov-09 1:06 
Hello there I am hoping that someone might be able to help me optimize my code for an XNA Program I have made, basically I have made my own custom interface in XNA, now my interface works pretty similar to the ways that windows does, however if you nest too many controls inside each other, then the game really starts to run at a slow rate (fps wise), as it obviously the draw method for the controls are taking too long.

I have tried doing a background draw (using an event via BeginInvoke and EndInvoke), but I get lots of flashing and sometimes it even crashes, as it tries to access the Sprite Batch sometimes when it is still is use

Is there another way to optimize my code that will allow me to get my performance back again??

Here is a sample of the draw code for a container object:

if (m_pTexture != null)
{
    graphicsManager.Begin();
    if (bSetupClientArea)
        graphicsManager.SetupClientRect(TranslatedArea);
    if (Image_States == 0 || Image_States == 1)
        graphicsManager.Draw(m_pTexture, TranslatedArea, new Color(255, 255, 255, (byte)Alpha));
    else
    {
        int nSubHeight = m_pTexture.Height / Image_States;
        Rectangle src = new Rectangle(0, (int)Current_State * nSubHeight, m_pTexture.Width, nSubHeight);
        graphicsManager.Draw(m_pTexture, TranslatedArea, src, new Color(255, 255, 255, (byte)Alpha));
    }
    graphicsManager.End();
    DrawBorder(graphicsManager);
}
for (int i = 0; i < m_pComponents.Count; ++i)
{
    Component component = m_pComponents[i];
    if (component.Visible)
        component.Draw(gameTime, graphicsManager, true);
}


As you can see each container has its own Rectangular Area, and it will basically use the graphics manager (which contains the sprite batch object for my XNA Program) to setup it's clip area and draw all of the contents to it, of course using this method means every container has to use begin and end from the graphics manager, to make sure that the objects are drawn correctly

Does calling the SpriteBatch.Begin and End function numerous times cause it to slow down considerably??
Or do you think something else is causing it to slow down??
AnswerRe: XNA: Game updating slowly Pin
harold aptroot4-Nov-09 5:49
harold aptroot4-Nov-09 5:49 
GeneralRe: XNA: Game updating slowly Pin
jdneul4-Nov-09 6:54
jdneul4-Nov-09 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.