Click here to Skip to main content
15,879,535 members
Home / Discussions / C#
   

C#

 
GeneralRe: tlbimp marshaling problems. Pin
Stephane Rodriguez.31-Dec-03 22:11
Stephane Rodriguez.31-Dec-03 22:11 
GeneralDefault Button for a Form Pin
Anonymous30-Dec-03 21:48
Anonymous30-Dec-03 21:48 
GeneralRe: Default Button for a Form Pin
Mazdak30-Dec-03 21:53
Mazdak30-Dec-03 21:53 
Generalmaking String Bitmap Pin
azusakt30-Dec-03 20:25
azusakt30-Dec-03 20:25 
GeneralRe: making String Bitmap(Modified) Pin
Mazdak30-Dec-03 22:00
Mazdak30-Dec-03 22:00 
GeneralRe: making String Bitmap(Modified) Pin
azusakt30-Dec-03 22:40
azusakt30-Dec-03 22:40 
GeneralRe: making String Bitmap(Modified) Pin
Mazdak30-Dec-03 23:13
Mazdak30-Dec-03 23:13 
GeneralRe: making String Bitmap Pin
Heath Stewart31-Dec-03 4:26
protectorHeath Stewart31-Dec-03 4:26 
To actually create a bitmap, do something like the following (and read the documentation for the Bitmap and Graphics classes):
private void CreateBitmap(string text, Font font)
{
  // Create a bitmap of the width and height
  Bitmap bmp = new Bitmap(200, 80, PixelFormat.Format32bppArgb);
  Graphics g = Graphics.FromImage(bmp);
  RectangleF rect = new RectangleF(0f, 0f, 200f, 80f);
  g.FillRectangle(Brushes.White, rect);
  SizeF size = g.MessageString(text, font, rect.Size);
  StringFormat format = new StringFormat(StringFormatFlags.FitBlackBox);
  format.Alignment = StringAlignment.Center;
  format.LineAlignment = StringAlignment.Center;
  RectangleF posRect = new RectangleF(
    (rect.Width - size.Width) / 2,
    (rect.Height - size.Height / 2,
    size.Width,
    size.Height);
  g.DrawString(text, font, Brushes.Black, posRect, format);
  g.Dispose();
  // Save the bitmap
  bmp.Save("c:\file.bmp", ImageFormat.Bmp);
}


 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: making String Bitmap Pin
azusakt7-Jan-04 15:50
azusakt7-Jan-04 15:50 
GeneralRe: making String Bitmap Pin
Heath Stewart7-Jan-04 18:09
protectorHeath Stewart7-Jan-04 18:09 
GeneralProblem with FolderBrowserDialog Class Pin
ta10030-Dec-03 14:56
ta10030-Dec-03 14:56 
GeneralRe: Problem with FolderBrowserDialog Class Pin
Heath Stewart31-Dec-03 4:09
protectorHeath Stewart31-Dec-03 4:09 
GeneralRe: Problem with FolderBrowserDialog Class Pin
ta1001-Jan-04 6:31
ta1001-Jan-04 6:31 
GeneralPrinting Form Pin
IntegraSoft30-Dec-03 13:44
IntegraSoft30-Dec-03 13:44 
GeneralRe: Printing Form Pin
Mazdak30-Dec-03 19:41
Mazdak30-Dec-03 19:41 
GeneralRe: Printing Form Pin
Heath Stewart30-Dec-03 19:42
protectorHeath Stewart30-Dec-03 19:42 
QuestionDrawing panels in ownerdraw listbox? Pin
pwinant30-Dec-03 13:31
pwinant30-Dec-03 13:31 
GeneralPublic/Private Keys Pin
Guinness4Strength30-Dec-03 11:15
Guinness4Strength30-Dec-03 11:15 
GeneralExecuting code for more than 1 statements Pin
Melanius30-Dec-03 10:42
Melanius30-Dec-03 10:42 
GeneralRe: Executing code for more than 1 statements Pin
Colin Angus Mackay30-Dec-03 10:54
Colin Angus Mackay30-Dec-03 10:54 
GeneralRe: Executing code for more than 1 statements Pin
Heath Stewart30-Dec-03 11:27
protectorHeath Stewart30-Dec-03 11:27 
GeneralRe: Executing code for more than 1 statements Pin
Melanius30-Dec-03 11:30
Melanius30-Dec-03 11:30 
GeneralRe: Executing code for more than 1 statements Pin
Melanius31-Dec-03 6:46
Melanius31-Dec-03 6:46 
GeneralGuid in DataTable Pin
Mazdak30-Dec-03 9:30
Mazdak30-Dec-03 9:30 
GeneralRe: Guid in DataTable Pin
Heath Stewart30-Dec-03 11:23
protectorHeath Stewart30-Dec-03 11:23 

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.