Click here to Skip to main content
15,921,660 members
Home / Discussions / C#
   

C#

 
GeneralRe: Customizing .NET Collection Editor Pin
StealthyMark7-May-05 12:15
StealthyMark7-May-05 12:15 
GeneralCustomizing .NET Collection Editor Pin
heavenamour6-May-05 18:49
heavenamour6-May-05 18:49 
Generaldisplaying and zooming in and out of a pdf Pin
brian556-May-05 11:58
brian556-May-05 11:58 
GeneralRe: displaying and zooming in and out of a pdf Pin
Yulianto.6-May-05 16:23
Yulianto.6-May-05 16:23 
GeneralRe: displaying and zooming in and out of a pdf Pin
brian556-May-05 16:56
brian556-May-05 16:56 
GeneralRe: displaying and zooming in and out of a pdf Pin
Yulianto.6-May-05 17:07
Yulianto.6-May-05 17:07 
GeneralRe: displaying and zooming in and out of a pdf Pin
Uwe Keim7-May-05 5:23
sitebuilderUwe Keim7-May-05 5:23 
GeneralProblem with redrawing text in a windows form Pin
Darktaz6-May-05 10:44
Darktaz6-May-05 10:44 
Can someone please help me with correcting the following code. Everything is fine until you expand the window (the text gets all messed up).

Create a new windows form 300x300 and put the following code into the constructer after the InitializeComponent call. An run it, you will see my problem.

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics dc = CreateGraphics();
// Set the bounds for redrawing, initial client size is 300x300
if (dc.ClipBounds.Top < 300 && dc.ClipBounds.Left < 300)
{
int screenHeight = Convert.ToInt32(ClientSize.Height);
int screenWidth = Convert.ToInt32(ClientSize.Width);
// Set up string.
string measureString = "This is just a test to see if this text will wrap the screen whilst also resizing with the window";
Font stringFont = new Font("Arial", 12);

// Set maximum layout size.
SizeF layoutSize = new SizeF(ClientSize.Width, ClientSize.Height);

// Measure string.
SizeF stringSize = new SizeF();
stringSize = dc.MeasureString(measureString, stringFont, layoutSize);

// Set the bounds for the text when drawn to screen
int quewidth = Convert.ToInt32(ClientSize.Width);
int queheight = Convert.ToInt32(stringSize.Height);
Rectangle questionRect = new Rectangle(0, 0, quewidth, queheight);
int screenheight = Convert.ToInt32(ClientSize.Height);

// Draw rectangle representing size of string.
dc.DrawRectangle(new Pen(Color.Red, 1), 0.0F, 0.0F, ClientSize.Width, stringSize.Height);

// Draw string to screen.
dc.DrawString(measureString, stringFont, Brushes.Black, questionRect);
dc.DrawString("quewidth = " + quewidth + "\n screenheight = " + screenheight + "\n", stringFont, Brushes.Black, new PointF(50, stringSize.Height+12.0F));

}
}
GeneralRe: Problem with redrawing text in a windows form Pin
MoustafaS6-May-05 13:09
MoustafaS6-May-05 13:09 
GeneralRe: Problem with redrawing text in a windows form Pin
Darktaz6-May-05 13:34
Darktaz6-May-05 13:34 
GeneralRe: Problem with redrawing text in a windows form Pin
MoustafaS6-May-05 14:15
MoustafaS6-May-05 14:15 
GeneralForm.Hide(), or Form.Close() not working Pin
Jeea6-May-05 10:01
Jeea6-May-05 10:01 
GeneralRe: Form.Hide(), or Form.Close() not working Pin
Dave Kreskowiak6-May-05 12:08
mveDave Kreskowiak6-May-05 12:08 
GeneralNewly created file stays locked Pin
dratcha6-May-05 9:46
dratcha6-May-05 9:46 
GeneralRe: Newly created file stays locked Pin
Colin Angus Mackay6-May-05 10:52
Colin Angus Mackay6-May-05 10:52 
GeneralRe: Newly created file stays locked Pin
dratcha6-May-05 11:18
dratcha6-May-05 11:18 
GeneralForm Show() method hangs, does not display controls Pin
methodincharge6-May-05 7:26
methodincharge6-May-05 7:26 
GeneralRe: Form Show() method hangs, does not display controls Pin
S. Senthil Kumar6-May-05 7:59
S. Senthil Kumar6-May-05 7:59 
GeneralRe: Form Show() method hangs, does not display controls Pin
methodincharge6-May-05 8:46
methodincharge6-May-05 8:46 
GeneralRe: Form Show() method hangs, does not display controls Pin
S. Senthil Kumar6-May-05 20:12
S. Senthil Kumar6-May-05 20:12 
GeneralWindows Form Multiline ListView Pin
rana936-May-05 7:23
rana936-May-05 7:23 
GeneralWinForms Datagrid format based on cell value Pin
Jose Guay6-May-05 7:14
Jose Guay6-May-05 7:14 
GeneralRe: WinForms Datagrid format based on cell value Pin
Polis Pilavas6-May-05 8:14
Polis Pilavas6-May-05 8:14 
GeneralRe: WinForms Datagrid format based on cell value Pin
Jose Guay6-May-05 12:04
Jose Guay6-May-05 12:04 
GeneralRe: WinForms Datagrid format based on cell value Pin
Polis Pilavas6-May-05 12:14
Polis Pilavas6-May-05 12:14 

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.