Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi, i have a problem regarding appending a picture within a picturebox.
There is a a panel, that contains FORMNAME-textbox, FORM-Picturebox. Save-button.
in the menu strip, I have a combobox that displays the names of the picture-templates that have been saved in database. If you choose one of them, its corresponding image appears in the PictureBox.
 
all of the above is working well. What i have been trying to do is to append a generated image from a signature(that would be a picture too) if i opened the items in the combobox. I have a specific place where to put it in the FORM-picture but i cant put it there because the vb.design only show the Panel and the Picturebox(which is Auto SIzed btw) in which i put the FORM.
 
anyone have an idea? please help me.
 
I can give the project in vb so that you can see what my problem is, i cant upload it here..
Posted 22-Mar-12 8:13am
kimsnap633
Edited 22-Mar-12 8:30am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Do yourself a favor, don't torture yourself abusing PictureBox. This is a very usual mistake.
 
This control is only good to do something very simple, like showing just one picture (well, maybe changing it, but not often). When you try to do anything more tricky, such as dynamic, interactive, animated, etc., it turns out to be more of an obstacle then a help, eating up your development time, computer performance and extra resources, giving nothing useful in return.
 
Compared to what? To a custom control derived from System.Windows.Forms.Control with graphics rendered in the handler of the event Paint, or, better yet, overridden virtual method OnPaint.
 
I explain how in my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^].
 
See also other answers:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^].
 
—SA
  Permalink  
Comments
kimsnap at 22-Mar-12 14:34pm
   
hi sir can i push your kindness a bit more, i would like to show you what have i done and what i am trying to do. so that you'll understand me more..
is there a way that i can upload my project here?
SAKryukov at 22-Mar-12 15:23pm
   
Sure, I don't mind, but I don't want to consider using PictureBox anymore -- it would be a waste of time. It would be the best if you conceptually describe the goal (including the ultimate goal of the project) and the workflow. Using "Improve question" and appending the information would be the best, but in this case please notify me by commenting this message, if you want me to respond, OK?
--SA
kimsnap at 22-Mar-12 16:07pm
   
the picturebox, wow. To be honest sir i dont have another idea what to use. :( i have uploaded my work http://www.4shared.com/zip/CQav5Hzl/file.html
it have description there but please tell me if there is something to ask.. thank a lot.
SAKryukov at 22-Mar-12 16:40pm
   
To be honest, you can easily get that idea if you simply read my answers I referenced above. This is much simpler and less wasteful then PictureBox. As I say, this design mistake is very typical. You don't need to repeat it. If something is unclear, please ask further questions.
--SA
SAKryukov at 22-Mar-12 16:41pm
   
Please, let me explain: you are interested to ask me, not that I'm interested to ask you. I already pointed out where you go wrong. If you disagree, you are welcome to argue, of course.
--SA
Shahin Khorshidnia at 22-Mar-12 16:28pm
   
+5
SAKryukov at 22-Mar-12 16:38pm
   
Thank you, Shahin.
--SA
kimsnap at 22-Mar-12 17:13pm
   
ok thanks im sorry if i sound demanding or anything offensive to you.. ill look them up again..
SAKryukov at 22-Mar-12 21:40pm
   
No, no, please don't get me wrong... nothing offensive whatsoever. Everything is all right. I'm talking about purely practical situation: I think I we should first simplify the situation by subtractive PictureBox from equation; it's just redundant level of indirection which could be useful only in simple static situation. A minimal complication like "append a picture" makes it impractical, redundant, not helping anymore. I suggest you how to get a background on how graphics is rendered on more direct level (a PictureBox implementation is just a specialized case of it oriented for static applications). When you look at it, you will more clearly see the problem. OK? This is not hard to go...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Schatak 394
1 OriginalGriff 355
2 Sergey Alexandrovich Kryukov 119
3 _Amy 115
4 Rob Philpott 100
0 OriginalGriff 7,097
1 Sergey Alexandrovich Kryukov 5,623
2 Maciej Los 3,504
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 22 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100