Click here to Skip to main content
15,890,845 members
Home / Discussions / C#
   

C#

 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Richard MacCutchan19-Jan-18 8:01
mveRichard MacCutchan19-Jan-18 8:01 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884019-Jan-18 11:30
Member 1228884019-Jan-18 11:30 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Pete O'Hanlon19-Jan-18 22:22
mvePete O'Hanlon19-Jan-18 22:22 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884020-Jan-18 6:59
Member 1228884020-Jan-18 6:59 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Pete O'Hanlon20-Jan-18 22:27
mvePete O'Hanlon20-Jan-18 22:27 
QuestionProject Reference Installed Applications Pin
TheCoolTech18-Jan-18 5:32
TheCoolTech18-Jan-18 5:32 
AnswerRe: Project Reference Installed Applications Pin
OriginalGriff18-Jan-18 5:48
mveOriginalGriff18-Jan-18 5:48 
AnswerRe: Project Reference Installed Applications Pin
Richard MacCutchan18-Jan-18 6:40
mveRichard MacCutchan18-Jan-18 6:40 
QuestionCannot convert from ref decimal? to ref decimal Pin
Kevin Marois18-Jan-18 5:30
professionalKevin Marois18-Jan-18 5:30 
AnswerRe: Cannot convert from ref decimal? to ref decimal Pin
F-ES Sitecore18-Jan-18 6:12
professionalF-ES Sitecore18-Jan-18 6:12 
GeneralRe: Cannot convert from ref decimal? to ref decimal Pin
Kevin Marois18-Jan-18 6:23
professionalKevin Marois18-Jan-18 6:23 
AnswerRe: Cannot convert from ref decimal? to ref decimal Pin
Gerry Schmitz19-Jan-18 7:38
mveGerry Schmitz19-Jan-18 7:38 
QuestionBest Performance Datagrid for WinForms Pin
Burhu18-Jan-18 3:54
professionalBurhu18-Jan-18 3:54 
AnswerRe: Best Performance Datagrid for WinForms Pin
Dave Kreskowiak18-Jan-18 4:42
mveDave Kreskowiak18-Jan-18 4:42 
QuestionC# Remote Desktop Using C# .Net Pin
Babiiii18-Jan-18 2:27
Babiiii18-Jan-18 2:27 
AnswerRe: C# Remote Desktop Using C# .Net Pin
OriginalGriff18-Jan-18 2:30
mveOriginalGriff18-Jan-18 2:30 
QuestionHow can I put an triangle and square shape in the center using c# in image processing Pin
Member 1363007218-Jan-18 0:41
Member 1363007218-Jan-18 0:41 
AnswerRe: How can I put an triangle and square shape in the center using c# in image processing Pin
OriginalGriff18-Jan-18 0:52
mveOriginalGriff18-Jan-18 0:52 
For starters, look at your code:
if (opf.ShowDialog() == DialogResult.OK)
{
    pictureBox1.Image = Image.FromFile(opf.FileName);
}
Bitmap bmp = new Bitmap(opf.FileName);
pictureBox1.Image = Image.FromFile(opf.FileName);
Why are you doing that? Any of that, really?
If the OK button is pressed you load an image from a file. Then you load it again, and throw that away. Then you load it again and stuff it over the top of the first one you loaded.
If the Cancel button is pressed, you load the image (which will probably fail because there is no filename in the dialog) throw that away, and load it again (failing again) and muck up your picture box anyway...

Throw away the last two lines of that code. Then if and only if the user pressed OK
1) Load the image from the file
2) Copy the image into a new image and Dispose the original
3) Then set the copy as the PictureBox.Image

The reason for that is that when you create an image from a file, it locks the file until the Image is Disposed - so you need to work with a copy 99% of the time or your code fails in interesting ways later!

Then handle the PictureBox.Paint event. Inside that, you can use the supplied Graphics Context to draw over the Image using:
Graphics.DrawLine Method (Pen, Point, Point) (System.Drawing)[^] Call it three times fro your triangle.
Graphics.DrawRectangle Method (Pen, Int32, Int32, Int32, Int32) (System.Drawing)[^] Call it once to draw your rectangle.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: How can I put an triangle and square shape in the center using c# in image processing Pin
Member 1363007218-Jan-18 1:09
Member 1363007218-Jan-18 1:09 
GeneralRe: How can I put an triangle and square shape in the center using c# in image processing Pin
OriginalGriff18-Jan-18 1:49
mveOriginalGriff18-Jan-18 1:49 
AnswerRe: How can I put an triangle and square shape in the center using c# in image processing Pin
V.18-Jan-18 20:18
professionalV.18-Jan-18 20:18 
QuestionHow to show customer data and order count using EF & LINQ Pin
Mou_kol17-Jan-18 23:52
Mou_kol17-Jan-18 23:52 
AnswerRe: How to show customer data and order count using EF & LINQ Pin
Pete O'Hanlon18-Jan-18 1:08
mvePete O'Hanlon18-Jan-18 1:08 
GeneralRe: How to show customer data and order count using EF & LINQ Pin
Mou_kol18-Jan-18 1:47
Mou_kol18-Jan-18 1:47 
GeneralRe: How to show customer data and order count using EF & LINQ Pin
Richard Deeming18-Jan-18 5:19
mveRichard Deeming18-Jan-18 5:19 

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.