Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
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 
QuestionCustom reporting solution with SSRS Pin
Tridip Bhattacharjee7-May-14 21:03
professionalTridip Bhattacharjee7-May-14 21:03 
AnswerRe: Custom reporting solution with SSRS Pin
Mycroft Holmes7-May-14 23:21
professionalMycroft Holmes7-May-14 23:21 
GeneralRe: Custom reporting solution with SSRS Pin
Tridip Bhattacharjee8-May-14 21:24
professionalTridip Bhattacharjee8-May-14 21:24 
AnswerRe: Custom reporting solution with SSRS Pin
ZurdoDev8-May-14 7:53
professionalZurdoDev8-May-14 7:53 
GeneralRe: Custom reporting solution with SSRS Pin
Mycroft Holmes8-May-14 19:06
professionalMycroft Holmes8-May-14 19:06 
GeneralRe: Custom reporting solution with SSRS Pin
Tridip Bhattacharjee8-May-14 21:23
professionalTridip Bhattacharjee8-May-14 21:23 
GeneralRe: Custom reporting solution with SSRS Pin
Mycroft Holmes8-May-14 21:53
professionalMycroft Holmes8-May-14 21:53 
AnswerRe: Custom reporting solution with SSRS Pin
ZurdoDev9-May-14 1:21
professionalZurdoDev9-May-14 1:21 
GeneralRe: Custom reporting solution with SSRS Pin
ZurdoDev9-May-14 1:20
professionalZurdoDev9-May-14 1:20 
GeneralRe: Custom reporting solution with SSRS Pin
Tridip Bhattacharjee8-May-14 21:24
professionalTridip Bhattacharjee8-May-14 21:24 
AnswerRe: Custom reporting solution with SSRS Pin
ZurdoDev9-May-14 1:22
professionalZurdoDev9-May-14 1:22 
QuestionGenerate code automatically for repository design pattern Pin
Tridip Bhattacharjee7-May-14 20:49
professionalTridip Bhattacharjee7-May-14 20:49 
AnswerRe: Generate code automatically for repository design pattern Pin
BillWoodruff9-May-14 16:55
professionalBillWoodruff9-May-14 16:55 
Questioninvoking Text Transformation with Visual studio Package Pin
Kani Mozhi7-May-14 18:44
Kani Mozhi7-May-14 18:44 

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.