C/C++ :: How To Randomize Images In Multiple Picture Boxes

May 9, 2014

Here's what i'm searching for: I have a form with 3 pictureBoxes (pictureBox1,2,3). The form also contains one button.

What I want is that when the user clicks the button (so button_click event) that the 3 pictureBoxes each show a different picture. And when I click the button again again 3 different pictures will load.

I already found out that I need to make an arraylist for the pictures (there are about 100 pictures). A System.Random
to select random images. But I have absolutely no clue on how to write this code.

View 5 Replies


ADVERTISEMENT

C Sharp :: Assign Webcams To Picture Boxes

Sep 10, 2012

I have a c# form that has two pictureboxes on it. I use two webcams I want the first webcam to allways show it's image in picturebox 1 and the second webcam to allways show it's image in picturebox 2.

How can I write this and stop that annoying popup dialog asking me to select a webcam each time it runs.

View 1 Replies View Related

C# :: Why Multiple Entries In Combo Boxes

Oct 3, 2014

Why multiple entries in combo boxes?

private void Form1_Load(object sender, EventArgs e) {
try {
connection.Open();
OleDbCommand command=new OleDbCommand();
command.Connection=connection;
string query="select * from korisnici,dogadjaji";

[code]...

View 14 Replies View Related

C# :: Displaying Multiple Images And Adding Sales To Them?

Aug 28, 2014

My application requires the user to add sales to images, this is done by displaying the image for the GUI, and then the user would add sales using that images ID which is brought in from the database.

In part this is 2 questions, first question is what is the best way to generate a List for use when adding the sales to the database. The List would need multiple strings for each sale. So for example:

Image 1 (Sale)

- JPG ID
- Product ID
- Product Quantity

So i'm going to assume i'm best creating a new instance of a custom class for each sale, and then add each instance to a List<Sale>?

public class Sale
{
public int SaleID { get; set; }
public int JpgID { get; set; }
public int SaleQty { get; set; }
}

Then I need a decent way to update this List with the GUI controls. So maybe get the JPG ID and set name of the Sale Class Instance to the ID, in this way its unique and I can update that instance when it comes to increasing the sale of a product or decreasing it.

Second part comes to the design of the GUI of adding sales, when I made this using HTML/PHP that was easier. It looked something like this:

If I wrote some code to generate that kind of design again in C# it going to require many Controls, wouldn't that be a bit intensive on the system? I just want something which looks great but also functions good.

At some point I'm going to switch to WPF, but I just need to get a working prototype working now which my client can use, and then update it when I have more time as I have got other Web Related projects that need doing, so at the moment WPF is out of the question.

View 2 Replies View Related

C Sharp :: How To Display Multiple Images From SQL Server 2005 Into C# At Runtime

Mar 26, 2013

I stored multiple images in MySQL SERVER 2005. Now I want to retrieve particular category of images into multiple picturebox at runtime in C# Windows application. i used the following code in my final result form at form_Load using c# windows apps.. But it displays only one picture at run time.

SqlConnection con = new SqlConnection(@"Data Source=ttt-PC;Initial Catalog=Query_Image;Integrated Security=True");
SqlCommand cmdnew = new SqlCommand("select pic from Image_Category 
where IMG_Cat='" + searchvalue.ToString() + "'", con);
con.Open();

[Code] ....

View 2 Replies View Related

C/C++ :: How To Randomize A Question With Right Number

Apr 3, 2014

i have a program that will be a question and answer . my lecturer want the question to be randomize

View 1 Replies View Related

C++ :: How To Randomize Answer Order With Push Back

May 8, 2014

How to now randomize the answer order within this code ? I only included the relevant piece of code of the task in question.

questions.push_back(
"Question [1]"
" "
"What port does HTTPS use ? "
"1. 25 "
"2. 443 "
"3. 23 ");

answers.push_back("2");

View 3 Replies View Related

C :: Reaction Game - How To Create Randomize Algorithm Which Gets Exponentially Faster

Mar 29, 2014

I am creating a reaction game using a series of lasers and LRDs and need to make a function which waits for a specific pin in portb to be triggered high before it can move onto waiting for the next pin to be triggered. The time lasped before the "game loses" needs to get exponentially faster as the game goes on.

I am using statements such as if(input(PIN_B0)==1 generate_tone(G_note[2], 1000); but unsure how to write in c "wait x amount of time, if trigger move onto next random pin or no trigger go to lose function.

View 8 Replies View Related

C++ :: Distributing Quantity R In M Boxes

Feb 24, 2014

I have an array of size m and r resources. What would be an efficient (or just any) way of distributing them in the way shown in the table? The highest amount of resources must be concentrated in the middle of the array and all the resources must be distributed.

I'm not really set on exactly how steep the "slope" must be, I just need a way of approaching the problem.

Example with m=9 and r=13

box resources
0 0
1 0
2 2
3 2
4 4
5 2
6 2
7 1
8 0

View 3 Replies View Related

C++ :: How To Read Picture In HDC

Oct 6, 2013

#include "stdafx.h"
#include "iostream"
#include "conio.h"
#include "windows.h"
using namespace std;
void main(){
HDC hdc = GetDC(NULL);
DWORD color = GetPixel(hdc, 500, 500);

[Code] ....

From this code I think it reads pixel from screenshot. I want to read from file. I think I have to change this line

HDC hdc = GetDC(NULL);

but I don't know how to?

View 6 Replies View Related

C# :: Using Check Boxes To Find Total Value?

Mar 1, 2015

Basically, I am designing a form that shows all of the services a mechanic performs, and then it is supposed to calculate the total based on the selections made.

HOW do I use those check boxes to calculate a total? I am supposed to use value-returning methods that solve for the parts cost, flush charges, tax charges, misc costs, etc. Ive attached a picture of the form thus to make sense of what I'm trying to describe.

View 5 Replies View Related

C# :: Proper Validation Of Text Boxes?

Dec 1, 2014

So I am writing a multiform multiclass project for a class and I initially set out to create a validate class to check all of my text boxes. However after writing a few simple boolean functions to check if the box was empty or not, or if it was indeed an integer, decimal ect. I realized I was going to have to call these functions for every text box and also have all of my decision making based on the returned boolean variable still in the code portion of my form. I was wondering how do most people do it, should I write a class that validates the entire form at once(one form has 7 text boxes, one has 9). I suppose I am asking what would the industry standard be, how would a professional do it? While my simple functions would work, and while I could write one large function that validates them all at once both paths leave something to be desired in terms of re-usability for the entire form validation, and compact/cleanliness of code for the simple functions.

My validate class currently stands like this:

class Validate {
bool isValid = true;
int trash;
bool valid_string(string input) //parameter is textbox.text property {
if (input == string.Empty)

[Code] ......

View 7 Replies View Related

C# :: Printing Picture Not Come On Center Of Page?

Jun 11, 2014

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap myBitmap1 = new Bitmap(pictureBox1.Width,pictureBox1.Height);
pictureBox1.DrawToBitmap(myBitmap1, new Rectangle(0 , 0, pictureBox1.Width, pictureBox1.Height));
e.Graphics.DrawImage(myBitmap1, 0, 0);

[Code]...

when i print picture exist in picture box image come on top right why i need image come on center of page

View 2 Replies View Related

C++ :: How To Change Ordinary Picture With Only Red Channel

Aug 29, 2013

With using SDL_Maprgb and SDL_GetRgb. I am new to programming.

void put_pixel32 (SDL_Surface *surf, int x, int y, Uint32 pixel){
Uint32 *pixels = (Uint32 *)surf->pixels;
pixels[(y * surf->w ) + x] = pixel;
}

how do i get use of this code?

Uint32 SDL_MapRGB(SDL_PixelFormat* format, Uint8 r, Uint8 g,Uint8 b);
void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat* format, Uint8*r, Uint8 *g,Uint8 *b)

I am using the existing picture. The function is just like Photoshop, can change the color only in red channel.

View 8 Replies View Related

Visual C++ :: Zoom In Using Picture Control?

Aug 13, 2013

I'm have a bitmap that's about 4000x2000. But I want to put it all into a picture control. I attempted to use stretchBlt() to shrink it. But it did not work.

Code:

HBITMAP originalImage = CreateDIBitmap(m_picture1.GetDC()->m_hDC,
m_bmiHeader,
CBM_INIT,
(unsigned short *)m_OriginalBits,

[Code]....

View 3 Replies View Related

C++ :: Input Length / Width And Height For 3 Boxes - Sum And Average Volume

Dec 6, 2013

How would I make it so that I can have someone input the length, width and height for all 3 boxes and then have it output the sum and average volume? Here's an example of what I would like:

INPUT - Enter Box 1 (Length, Width, Height): 10.1 11.2 3.3
INPUT – Enter Box 2 (Length, Width, Height): 5.5 6.6 7.7
INPUT – Enter Box 3 (Length, Width, Height): 4.0 5.0 8.0
OUTPUT – The sum of the volume is 812.806
OUTPUT – The average volume is 270.935

Here's my original code:

#include <iostream>
using namespace std;
double box(double length, double width, double height); // use double data
int main() {
double sum;
sum = box(10.1, 11.2, 3.3) + box(5.5, 6.6, 7.7) + box(4.0, 5.0, 8.0);

[Code] .....

View 1 Replies View Related

C# :: Unable To Use Public Class And Private Subs With Combo Boxes?

May 18, 2014

I've finally managed to do something with the combo box but knock down one wall it's like there's another one five inches behind it. What I mean is I've figured out how to add items to the combo box and have them show images in my picture box. Only problem is when I went to debug my combo box kept looping it's options over and over and over.

Private Sub
xpmaleskincolorselect.Items.Add("Tone1"); malesprite.Image = My.Resources.Resources.XP_Female_clear;
xpmaleskincolorselect.Items.Add("Tone2"); malesprite.Image = My.Resources.Resources.XP_Male_tan;
xpmaleskincolorselect.Items.Add("Tone3"); malesprite.Image = My.Resources.Resources.XP_Male_dark;
End Sub

The subs, I know they aren't right but its just to show I know where they go. Anyway using Private Sub and End sub doesn't seem to work. I'll type them in then at the error box at the bottom it'll say that it doesn't exist in the namespace. Same thing happened when I tried to add public class beforehand to see if that would work same thing about the name space.

View 8 Replies View Related

C# :: Bingo Calling Machine / Changing Numbers To Different Text Boxes?

Dec 28, 2014

I've recently started creating a bingo caller application. I need in changing numbers to different text boxes. When a number is called it will be displayed in a text box and the last four numbers previous to that. However the oldest number needs to delete and for the remening numbers to move when a new number is called.

View 2 Replies View Related

C Sharp :: Compile SQL Table Using Dropdown List Boxes Into TextBox

Sep 11, 2012

I am completely new to SQL server i know a few of the basics. I have a VS2010 asp.net c# application with two dropdown listboxes and a textbox. I need to calculate the numbers e.g 3 + 3 = Medium, using the table below to calculate the answer so i can insert the output value into a textbox.

Table
12345
1ColdColdColdColdHOT
2ColdColdColdMediumHOT
3ColdMediumMediumHOTHOT
4MediumMediumMediumHOTHOT
5MediumMediumMediumHOTHOT
Drop down Listbox3Drop down Listbox3

TextBoxMedium

View 3 Replies View Related

C/C++ :: How To Choose Which Picture To Load Using CImg Library

Jul 25, 2014

I've just started using the CImg library and when I try to load a picture with this code:

CImg<unsigned char> image("example.bmp");

It works perfectly. But when I try to type in the image file name using the console it gives me errors. For example, if I try this:

std::string input_file;
std::cin >> input_file;
CImg<unsigned char> image(input_file);

It doesn't work. The way I see it, I should be able type "example.bmp" into input_file and use it but it doesn't work, and gives me the error:

"error: no matching function for call to 'cimg_library::CImg<unsigned char>::CImg(std::string&)"

I have included iostream and string.h.

View 3 Replies View Related

C# :: Using Listbox To Change Image In Picture Box And Text In Label

Mar 21, 2012

My goal is to have couple of items in the listbox and when highlighting one item a image in the picturebox should appear, and so on for each item in the listbox.I just don't know how to change image depending on selected item in the listbox instantly.Also when i highlight item a text in label should be like in highlighted item in listbox.

View 1 Replies View Related

Visual C++ :: Get Cursor Position For Picture Control With Scroll Bar

Apr 25, 2014

I was loaded a bitmap using this code. I'm using mousemove method to known the Dialog's mouse move position & get the RGB pixel.

I want to get the picture contol's mouse move position & using this point (x,y) i will get the particular color ref value R, G, & B.

My picture control size is 256 * 256 & I was loaded an image 512 * 512.

Using scroll bar, I was view the image but can't get the particular pixel in the picture control.

The below code get the Dialog's mouse move cursor position & RGB Values only.

Code:
void CMyDlg::OnMouseMove(UINT nFlags, CPoint point) {
int R,G,B;
COLORREF ref;
ref = m_dcMem.GetPixel(point.x,point.y);
R = GetRValue(ref);
G = GetGValue(ref);
B = GetBValue(ref);
CButton::OnMouseMove(nFlags, point);
}

How can i get the picture contol position even use the scroll bar.

View 1 Replies View Related

Visual C++ :: MFC - FrameWnd Output To Picture Control In Dialog

May 29, 2014

I am working on a MFC application that I used for Image Analysis. I have a FrameWnd called MillChart that I use to generate an Image. This window is displayed at the run time in the application and not a part of the GUI dialog. It automatically resizes according to the different monitor resolutions and because of this there is a lot of empty space to the right of the MillChart. I was planning to add a picture control in the GUI dialog and redirect whatever is displayed in the MillChart to the Picture Control so that I can place my other elements (checkboxes, scrollbars etc) that I use in my app close to this MillChart and also set the size of the MillChart to a constant size.

Here is the code for positioning the elements (Note: I have only shown the MillChart position)

Code:
void CMainFrame::PositionElements()
{
CRect r, r2, r3;
GetClientRect(&r);
int mcs = r.Height() - r2.Height();
mMillChart->MoveWindow(r.right - r2.Width(),r.top + r2.Height(),mcs,mcs);

[Code] .....

View 1 Replies View Related

C Sharp :: Show Results From Values In Text Boxes On Clicking Or Pressing Tab Button

Feb 21, 2013

I am developing application software.entering two textbox value,while click or pressing tab button in third textbox, the result needs to show in third textbox.

View 1 Replies View Related

Visual C++ :: Creating Static Text Boxes Dynamically - Assigning Unique Control ID?

Dec 16, 2012

I'm using CStatic inherited class in my code and creating static text boxes dynamically. Now for assigning unique control ID I'm creating a static control from resource editor and destroying it before calling CStatic::Create() and using its control ID say ID_STATIC_SAMPLE.

If I do not use this parameter of Create(), the static control is also being created, so what is the use of this unique ID. And any other better way to assign a ID for dynamically created static controls.

View 3 Replies View Related

C++ :: Dialog Based Application - Draw Line Inside Picture Box

Feb 24, 2014

I create the dialog based application and draw the line inside the picture box. if line is drawn then display the msgbox, if not close the msg box and resize the window then the line is disappear and blank area is shown in picturbox.blem

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved