Click here to Skip to main content
15,911,848 members
Home / Discussions / C#
   

C#

 
QuestionInserting multiple IDs in Items table but the same ID should go into MasterRequest table just once. Pin
Omar Akhtar 200921-May-10 20:51
Omar Akhtar 200921-May-10 20:51 
AnswerRe: Inserting multiple IDs in Items table but the same ID should go into MasterRequest table just once. Pin
Mohsiul Haque21-May-10 22:46
Mohsiul Haque21-May-10 22:46 
GeneralRe: Inserting multiple IDs in Items table but the same ID should go into MasterRequest table just once. Pin
Omar Akhtar 200922-May-10 1:57
Omar Akhtar 200922-May-10 1:57 
GeneralIt Works! PinPopular
Roger Wright21-May-10 18:33
professionalRoger Wright21-May-10 18:33 
GeneralRe: It Works! Pin
Luc Pattyn21-May-10 22:36
sitebuilderLuc Pattyn21-May-10 22:36 
GeneralRe: It Works! Pin
Roger Wright22-May-10 4:20
professionalRoger Wright22-May-10 4:20 
GeneralRe: It Works! Pin
Luc Pattyn22-May-10 4:30
sitebuilderLuc Pattyn22-May-10 4:30 
GeneralRe: It Works! Pin
DaveyM6921-May-10 22:46
professionalDaveyM6921-May-10 22:46 
Congratulations Beer | [beer]

Roger Wright wrote:
do them in AutoCAD, export them to pdf in CutePDF, import them and resize them in GIMP 2, then save them as jpg


Yeah, just drawing them will be way easier!

If you're using WinForms (I seem to remember you were) then the easiest way to start is to draw your own control and drop that on a form rather than try to draw on the form itself. A Panel is a good control to derive from for this.

The little snippet below shows the basic principle - I've made this control redraw and realign a legend when the Padding property changes as an example.
C#
using System;
using System.Drawing;
using System.Windows.Forms;

namespace RogerWright.Drawing
{
    public class DrawingSurface : Panel
    {
        private const string Legend = "Drawing Surface";

        public DrawingSurface()
        {
            DoubleBuffered = true;
        }

        private Rectangle GetLayoutRectangle()
        {
            return new Rectangle(
                    Padding.Left,
                    Padding.Top,
                    Width - Padding.Horizontal,
                    Height - Padding.Vertical);
        }
        protected override void OnPaddingChanged(EventArgs e)
        {
            Invalidate();
            base.OnPaddingChanged(e);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            // begin custom drawing
            Rectangle layoutRectangle = GetLayoutRectangle();
            using (Brush textBrush = new SolidBrush(ForeColor))
            {
                e.Graphics.DrawString(Legend, Font, textBrush, layoutRectangle);
            }
            float yOffset = e.Graphics.MeasureString(Legend, Font).Height;
            // ...
            // end custom drawing
            base.OnPaint(e);
        }
    }
}
Hope it helps!
Dave

If this helped, please vote & accept answer!


Binging is like googling, it just feels dirtier. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

GeneralRe: It Works! Pin
Roger Wright22-May-10 4:23
professionalRoger Wright22-May-10 4:23 
GeneralRe: It Works! Pin
Roger Wright27-May-10 16:55
professionalRoger Wright27-May-10 16:55 
GeneralRe: It Works! Pin
DaveyM6928-May-10 8:47
professionalDaveyM6928-May-10 8:47 
GeneralRe: It Works! Pin
Roger Wright28-May-10 15:45
professionalRoger Wright28-May-10 15:45 
GeneralRe: It Works! Pin
Mohsiul Haque21-May-10 22:52
Mohsiul Haque21-May-10 22:52 
GeneralRe: It Works! Pin
Ravi Bhavnani22-May-10 6:05
professionalRavi Bhavnani22-May-10 6:05 
GeneralRe: It Works! Pin
PIEBALDconsult22-May-10 8:18
mvePIEBALDconsult22-May-10 8:18 
QuestionC # Pin
Make Up Forever21-May-10 14:27
Make Up Forever21-May-10 14:27 
AnswerRe: C # Pin
Dr.Walt Fair, PE21-May-10 14:55
professionalDr.Walt Fair, PE21-May-10 14:55 
GeneralRe: C # Pin
Make Up Forever21-May-10 15:11
Make Up Forever21-May-10 15:11 
GeneralRe: C # Pin
AspDotNetDev21-May-10 15:31
protectorAspDotNetDev21-May-10 15:31 
GeneralRe: C # Pin
Dr.Walt Fair, PE21-May-10 15:34
professionalDr.Walt Fair, PE21-May-10 15:34 
AnswerRe: C # Pin
Wes Aday21-May-10 17:05
professionalWes Aday21-May-10 17:05 
QuestionError Icomparer interface - To sort FileInfo Pin
quanvt21-May-10 13:55
quanvt21-May-10 13:55 
AnswerRe: Error Icomparer interface - To sort FileInfo Pin
Luc Pattyn21-May-10 14:20
sitebuilderLuc Pattyn21-May-10 14:20 
AnswerRe: Error Icomparer interface - To sort FileInfo Pin
AspDotNetDev21-May-10 15:39
protectorAspDotNetDev21-May-10 15:39 
GeneralRe: Error Icomparer interface - To sort FileInfo Pin
quanvt21-May-10 17:43
quanvt21-May-10 17:43 

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.