Click here to Skip to main content
15,566,185 members
Home / Discussions / C#
   

C#

 
GeneralRe: tlbimp marshaling problems. Pin
Stephane Rodriguez.31-Dec-03 23:11
Stephane Rodriguez.31-Dec-03 23:11 
GeneralDefault Button for a Form Pin
Anonymous30-Dec-03 22:48
Anonymous30-Dec-03 22:48 
GeneralRe: Default Button for a Form Pin
Mazdak30-Dec-03 22:53
Mazdak30-Dec-03 22:53 
Generalmaking String Bitmap Pin
azusakt30-Dec-03 21:25
azusakt30-Dec-03 21:25 
GeneralRe: making String Bitmap(Modified) Pin
Mazdak30-Dec-03 23:00
Mazdak30-Dec-03 23:00 
GeneralRe: making String Bitmap(Modified) Pin
azusakt30-Dec-03 23:40
azusakt30-Dec-03 23:40 
GeneralRe: making String Bitmap(Modified) Pin
Mazdak31-Dec-03 0:13
Mazdak31-Dec-03 0:13 
GeneralRe: making String Bitmap Pin
Heath Stewart31-Dec-03 5:26
protectorHeath Stewart31-Dec-03 5: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 16:50
azusakt7-Jan-04 16:50 
GeneralRe: making String Bitmap Pin
Heath Stewart7-Jan-04 19:09
protectorHeath Stewart7-Jan-04 19:09 
GeneralProblem with FolderBrowserDialog Class Pin
ta10030-Dec-03 15:56
ta10030-Dec-03 15:56 
GeneralRe: Problem with FolderBrowserDialog Class Pin
Heath Stewart31-Dec-03 5:09
protectorHeath Stewart31-Dec-03 5:09 
GeneralRe: Problem with FolderBrowserDialog Class Pin
ta1001-Jan-04 7:31
ta1001-Jan-04 7:31 
GeneralPrinting Form Pin
IntegraSoft30-Dec-03 14:44
IntegraSoft30-Dec-03 14:44 
GeneralRe: Printing Form Pin
Mazdak30-Dec-03 20:41
Mazdak30-Dec-03 20:41 
GeneralRe: Printing Form Pin
Heath Stewart30-Dec-03 20:42
protectorHeath Stewart30-Dec-03 20:42 
QuestionDrawing panels in ownerdraw listbox? Pin
pwinant30-Dec-03 14:31
pwinant30-Dec-03 14:31 
GeneralPublic/Private Keys Pin
Guinness4Strength30-Dec-03 12:15
Guinness4Strength30-Dec-03 12:15 
GeneralExecuting code for more than 1 statements Pin
Melanius30-Dec-03 11:42
Melanius30-Dec-03 11:42 
GeneralRe: Executing code for more than 1 statements Pin
Colin Angus Mackay30-Dec-03 11:54
Colin Angus Mackay30-Dec-03 11:54 
GeneralRe: Executing code for more than 1 statements Pin
Heath Stewart30-Dec-03 12:27
protectorHeath Stewart30-Dec-03 12:27 
GeneralRe: Executing code for more than 1 statements Pin
Melanius30-Dec-03 12:30
Melanius30-Dec-03 12:30 
GeneralRe: Executing code for more than 1 statements Pin
Melanius31-Dec-03 7:46
Melanius31-Dec-03 7:46 
GeneralGuid in DataTable Pin
Mazdak30-Dec-03 10:30
Mazdak30-Dec-03 10:30 
GeneralRe: Guid in DataTable Pin
Heath Stewart30-Dec-03 12:23
protectorHeath Stewart30-Dec-03 12: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.