Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
QuestionImplementing IDisposable Pin
Gilbert Consellado8-May-14 22:58
professionalGilbert Consellado8-May-14 22:58 
AnswerRe: Implementing IDisposable Pin
Pete O'Hanlon8-May-14 23:58
mvePete O'Hanlon8-May-14 23:58 
GeneralRe: Implementing IDisposable Pin
Gilbert Consellado9-May-14 0:05
professionalGilbert Consellado9-May-14 0:05 
GeneralRe: Implementing IDisposable Pin
Pete O'Hanlon9-May-14 0:36
mvePete O'Hanlon9-May-14 0:36 
GeneralRe: Implementing IDisposable Pin
Gilbert Consellado9-May-14 1:11
professionalGilbert Consellado9-May-14 1:11 
GeneralRe: Implementing IDisposable Pin
Dave Kreskowiak9-May-14 1:26
mveDave Kreskowiak9-May-14 1:26 
GeneralRe: Implementing IDisposable Pin
Gilbert Consellado9-May-14 1:38
professionalGilbert Consellado9-May-14 1:38 
Questionpolling call to a url Pin
nitin_ion8-May-14 20:38
nitin_ion8-May-14 20:38 
AnswerRe: polling call to a url Pin
Pete O'Hanlon8-May-14 20:52
mvePete O'Hanlon8-May-14 20:52 
QuestionDrawing a rectangle using GraphicsPath in C# doesn't complete the drawing (GDI+) Pin
jesuraj.pradeep8-May-14 20:05
jesuraj.pradeep8-May-14 20:05 
AnswerRe: Drawing a rectangle using GraphicsPath in C# doesn't complete the drawing (GDI+) Pin
Bernhard Hiller8-May-14 21:36
Bernhard Hiller8-May-14 21:36 
AnswerRe: Drawing a rectangle using GraphicsPath in C# doesn't complete the drawing (GDI+) Pin
OriginalGriff8-May-14 21:41
mveOriginalGriff8-May-14 21:41 
QuestionSearch and Retrieving String Pin
ASPnoob8-May-14 20:01
ASPnoob8-May-14 20:01 
AnswerRe: Search and Retrieving String Pin
Mycroft Holmes8-May-14 21:21
professionalMycroft Holmes8-May-14 21:21 
AnswerRe: Search and Retrieving String Pin
V.8-May-14 23:27
professionalV.8-May-14 23:27 
AnswerRe: Search and Retrieving String Pin
Emre Ataseven11-May-14 5:50
professionalEmre Ataseven11-May-14 5:50 
QuestionHandle Task Exception In Main Thread Pin
Kevin Marois8-May-14 14:31
professionalKevin Marois8-May-14 14:31 
QuestionDeveloping a .NET obfuscator. Need feedback. Pin
ianderf8-May-14 9:17
ianderf8-May-14 9:17 
AnswerRe: Developing a .NET obfuscator. Need feedback. Pin
Richard Andrew x648-May-14 11:05
professionalRichard Andrew x648-May-14 11:05 
GeneralRe: Developing a .NET obfuscator. Need feedback. Pin
ianderf8-May-14 11:10
ianderf8-May-14 11:10 
GeneralRe: Developing a .NET obfuscator. Need feedback. Pin
Richard MacCutchan8-May-14 22:46
mveRichard MacCutchan8-May-14 22:46 
QuestionBufferedGraphics object will AutoScroll position Pin
Chris Copeland8-May-14 7:23
mveChris Copeland8-May-14 7:23 
Hi guys,

I've been working on a custom component which acts as a 'view' control, such that it manually paints cells for child items. The component can contain hundreds of child items, which means that I've had to utilise the BufferedGraphics object for maintaining the graphics, and reset it only when the component is resized or when the child items are changed. Each child items also owns it's own BufferedGraphics object to maintain the rendering of each item (since these items can contain an Image in the graphics, it speeds up the painting considerably.)

A problem surfaces when I start to take into account scrolling through the use of AutoScroll and AutoScrollPosition. I've spent a good while trying to search for an answer to applying the scroll position offset to a BufferedGraphics and I've yet yielded unsuccessful results. Several problems are standing in the way of the scrolling functionality:

1. Graphics.TranslateTransform() or Graphics.Transform = new Matrix() does not translate a BufferedGraphics.Render() operation. I believe this is namely because the Render() function just paints directly onto the Graphics handle for the region it was allocated by.

For example, the below does not work:

override void OnPaint(PaintEventArgs e)
{
    // code here which deals with allocating the buffer if it needs creating

    // translate by the auto scroll position
    e.Graphics.TranslateTransform(-AutoScrollPosition.X, -AutoScrollPosition.Y);

    // render the buffered graphics onto the graphics handle for the paint event
    this.bufferedGraphics.Render(e.Graphics);
}


2. Following the code in this example [^] results in many invalidations, which causes the graphics to lag to the point that it's infeasible for the component.

My question is, is there a reliable method of being able to translate the buffered graphics of a BufferedGraphics object when painting onto a Graphics handle? For instance, could I allocate my BufferedGraphics as I do in point #1, and intrinsically invalidate the component upon scrolling and simply offset the buffered graphics depending on the position the user has scrolled to?

If not, can anyone recommend a suitable replacement for rendering like this? Obviously, components such as the ListView class have the ability to render many items with scrolling, with little issues with performance (depending on which double-buffering and CreateParams changes are made.)
AnswerRe: BufferedGraphics object will AutoScroll position Pin
Chris Copeland8-May-14 9:20
mveChris Copeland8-May-14 9:20 
QuestionNUnit- Custom Property Attribute display in Test Explorer window Pin
ercharu228-May-14 6:37
ercharu228-May-14 6:37 
QuestionTextTransformation with VS Packages Pin
Kani Mozhi7-May-14 23:47
Kani Mozhi7-May-14 23:47 

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.