Click here to Skip to main content
15,890,527 members
Home / Discussions / C#
   

C#

 
QuestionVisual Studions 2005 and crystal reports 11.5 R2 Pin
krown24-May-10 2:56
krown24-May-10 2:56 
QuestionWhy am I recieving corrupt images? Pin
TimSWatson24-May-10 2:37
TimSWatson24-May-10 2:37 
AnswerRe: Why am I recieving corrupt images? Pin
Luc Pattyn24-May-10 4:53
sitebuilderLuc Pattyn24-May-10 4:53 
JokeRe: Why am I recieving corrupt images? Pin
Wes Aday24-May-10 8:27
professionalWes Aday24-May-10 8:27 
JokeRe: Why am I recieving corrupt images? Pin
DaveyM6924-May-10 9:06
professionalDaveyM6924-May-10 9:06 
GeneralRe: Why am I recieving corrupt images? Pin
TimSWatson25-May-10 4:42
TimSWatson25-May-10 4:42 
Questiontext alignment problem on the image.... Pin
Nivas8224-May-10 1:40
Nivas8224-May-10 1:40 
AnswerRe: text alignment problem on the image.... Pin
Luc Pattyn24-May-10 4:43
sitebuilderLuc Pattyn24-May-10 4:43 
Hi,

IMO that is all wrong from the very start. A Control_Paint handler is supposed to paint the control to the screen, yours modifies an image and does not paint to the screen at all.

This is how I would probably tackle this:

1. I'd have a Compose method that creates the composite image, by allocating a Bitmap of the right size, calling CreateGraphics() on it; then using that Graphics to paint the image and the rectangle and the text into the Bitmap.

2. I would call the Compose method when the composition has to change, which is unrelated to the user deciding to see, not see, scroll it.

3. Then show that Bitmap to the user; as I don't like PictureBox much, I probably would use a Panel of the right size, and use Graphics.DrawImage in its Paint handler.

The main advantages of such approach are:
- all parts of the composition are dealt with in the same way, they share the coordinate system, the mouse actions (if any), etc. No hassle with a PictureBox that may zoom/pan/center/fill the image, and treat everything else you draw on top of it in a different way.
- the composite image is available at all times; you can easily save it to disk, and to a database.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read formatted code with indentation, so please use PRE tags for code snippets.

I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).

GeneralRe: text alignment problem on the image.... Pin
Nivas8226-May-10 22:04
Nivas8226-May-10 22:04 
GeneralRe: text alignment problem on the image.... Pin
Luc Pattyn27-May-10 3:10
sitebuilderLuc Pattyn27-May-10 3:10 
AnswerRe: text alignment problem on the image.... [modified] Pin
Nivas8228-May-10 19:31
Nivas8228-May-10 19:31 
AnswerRe: text alignment problem on the image.... Pin
Nivas8230-May-10 22:37
Nivas8230-May-10 22:37 
QuestionUnable to figure out a proper subject line. Sorry. :( Pin
dashingsidds23-May-10 23:41
dashingsidds23-May-10 23:41 
AnswerRe: Unable to figure out a proper subject line. Sorry. :( Pin
Richard MacCutchan23-May-10 23:51
mveRichard MacCutchan23-May-10 23:51 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
dashingsidds24-May-10 0:40
dashingsidds24-May-10 0:40 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
Richard MacCutchan24-May-10 1:26
mveRichard MacCutchan24-May-10 1:26 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
PIEBALDconsult24-May-10 4:32
mvePIEBALDconsult24-May-10 4:32 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
dashingsidds24-May-10 18:43
dashingsidds24-May-10 18:43 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
PIEBALDconsult25-May-10 2:40
mvePIEBALDconsult25-May-10 2:40 
AnswerRe: Unable to figure out a proper subject line. Sorry. :( Pin
Pete O'Hanlon24-May-10 0:25
mvePete O'Hanlon24-May-10 0:25 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
dashingsidds24-May-10 0:43
dashingsidds24-May-10 0:43 
GeneralRe: Unable to figure out a proper subject line. Sorry. :( Pin
Pete O'Hanlon24-May-10 0:49
mvePete O'Hanlon24-May-10 0:49 
AnswerRe: Unable to figure out a proper subject line. Sorry. :( Pin
Łukasz Nowakowski24-May-10 0:51
Łukasz Nowakowski24-May-10 0:51 
AnswerRe: Unable to figure out a proper subject line. Sorry. :( Pin
Abhinav S24-May-10 1:40
Abhinav S24-May-10 1:40 
AnswerRe: Unable to figure out a proper subject line. Sorry. :( Pin
Kunal Chowdhury «IN»24-May-10 2:38
professionalKunal Chowdhury «IN»24-May-10 2:38 

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.