Click here to Skip to main content
15,909,656 members
Home / Discussions / C#
   

C#

 
General[Message Deleted] Pin
joynee13-Mar-08 9:23
joynee13-Mar-08 9:23 
GeneralRe: null reference exception not set to create an object instance Pin
led mike13-Mar-08 9:37
led mike13-Mar-08 9:37 
GeneralRe: null reference exception not set to create an object instance Pin
Giorgi Dalakishvili13-Mar-08 9:58
mentorGiorgi Dalakishvili13-Mar-08 9:58 
GeneralRe: null reference exception not set to create an object instance Pin
Ravenet13-Mar-08 17:07
Ravenet13-Mar-08 17:07 
GeneralRe: null reference exception not set to create an object instance Pin
Justin Perez14-Mar-08 3:00
Justin Perez14-Mar-08 3:00 
Generalcrystal report issue (hiding objct at runtime) Pin
Harvey Saayman13-Mar-08 7:46
Harvey Saayman13-Mar-08 7:46 
QuestionPreventing moving a toolstrip from one toolstripcontainer to another Pin
RobMaddison13-Mar-08 7:32
RobMaddison13-Mar-08 7:32 
QuestionHow to save drawing from picture box drawn in GDI+ into bmp file type? Pin
yuenli13-Mar-08 5:54
yuenli13-Mar-08 5:54 
Hi! I would like to export my drawing created in picture box using GDI+ into bitmap format. But it seem I am only getting a white blank screen. Can anyone help me to solve it? Thanks a lot.

using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Documents;
using System.Windows.Markup;

using StudentToolkit;

namespace test_drag
{
public partial class Window1
{
private Graphics g;
private System.Drawing.Pen pen1;

Bitmap bitmap;
Font font;
List<Concept> objList = new List<Concept>();
float x;
float y;
bool down = false;
int selectedIndex = -1;

public Window1()
{
this.InitializeComponent();
bitmap = new Bitmap(pictureBox.Width,pictureBox.Height);
g = Graphics.FromImage(bitmap);

Concept obj1 = new Concept("Rect", "Rect1", System.Drawing.Color.Black, 20, 20, 5, 5);
objList.Add(obj1);
Concept obj2 = new Concept("Oval", "Oval1", System.Drawing.Color.Blue, 20, 20, 40, 30);
objList.Add(obj2);
Concept obj3 = new Concept("Oval", "Oval1", System.Drawing.Color.Red, 20, 20, 80, 30);
objList.Add(obj3);
Concept obj4 = new Concept("Line", "line1", System.Drawing.Color.Aqua, 4, 80, 4, 50);
objList.Add(obj4);
font = new Font("Arial", 10);
// Insert code required on object creation below this point.

}

private void pictureBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
if (objList != null)
{
foreach (Concept obj in objList)
{
pen1 = new System.Drawing.Pen(obj.Brush_color, 1);
if (obj.Con_shape == "Rect")
e.Graphics.DrawRectangle(pen1, obj.XPos, obj.YPos, obj.Width, obj.Height);
else if (obj.Con_shape == "Oval")
e.Graphics.DrawEllipse(pen1, obj.XPos, obj.YPos, obj.Width, obj.Height);
else if (obj.Con_shape == "Line")
e.Graphics.DrawLine(pen1,obj.Height, obj.Width, obj.XPos, obj.YPos);

pen1.Dispose();
}
}
}

private void export_Click(object sender, RoutedEventArgs e)
{
int width = bitmap.Width;
int height = bitmap.Height;
int i, j;
for (i = 0; i < width; i++)
{
for (j = 0; j < height; j++)
{
System.Drawing.Color pixelColor = bitmap.GetPixel(i, j);
System.Drawing.Color newcolor = System.Drawing.Color.White;
bitmap.SetPixel(i, j, newcolor);
}
}
//
bitmap.Save(@"C:\concept1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("The created concept map has been exported to your local drive");
}
}
}
AnswerRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
led mike13-Mar-08 6:09
led mike13-Mar-08 6:09 
GeneralRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
leppie13-Mar-08 8:33
leppie13-Mar-08 8:33 
AnswerRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
Skippums13-Mar-08 6:55
Skippums13-Mar-08 6:55 
GeneralRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
yuenli13-Mar-08 13:43
yuenli13-Mar-08 13:43 
GeneralRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
KaptinKrunch13-Mar-08 17:11
KaptinKrunch13-Mar-08 17:11 
GeneralEditing ComboBox with DataSource Pin
polishprogrammer13-Mar-08 5:44
polishprogrammer13-Mar-08 5:44 
GeneralToolbox icon for user control Pin
hain13-Mar-08 5:25
hain13-Mar-08 5:25 
GeneralRe: Toolbox icon for user control Pin
led mike13-Mar-08 5:37
led mike13-Mar-08 5:37 
GeneralRe: Toolbox icon for user control Pin
hain13-Mar-08 5:44
hain13-Mar-08 5:44 
GeneralRe: Toolbox icon for user control Pin
led mike13-Mar-08 6:05
led mike13-Mar-08 6:05 
GeneralRe: Toolbox icon for user control [modified] Pin
hain13-Mar-08 6:17
hain13-Mar-08 6:17 
GeneralRe: Toolbox icon for user control Pin
led mike13-Mar-08 8:16
led mike13-Mar-08 8:16 
GeneralRe: Toolbox icon for user control Pin
leppie13-Mar-08 8:30
leppie13-Mar-08 8:30 
GeneralRe: Toolbox icon for user control Pin
hain13-Mar-08 10:17
hain13-Mar-08 10:17 
GeneralRe: Toolbox icon for user control Pin
hain13-Mar-08 10:20
hain13-Mar-08 10:20 
GeneralUnable to connect to Web Service Pin
Manoj Sethi13-Mar-08 5:01
Manoj Sethi13-Mar-08 5:01 
GeneralRe: Unable to connect to Web Service Pin
Muhammad Gouda13-Mar-08 5:04
Muhammad Gouda13-Mar-08 5:04 

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.