C# :: Keep Aspect Ratio When Resize Form

Dec 15, 2014

When I try to resize my form, every time i try to resize it while running, the window blinks between original size and the new size it was given, when i release the mouse it either stay in its new size or shrinks back to its original size, What makes it return to its original size, maybe its something with the form_Resize function..

private bool inForm_Resize = false;
private Size PrevSize;
private void Form1_Resize(object sender, EventArgs e) {
double dRatio = 1.6;
if (!inForm_Resize) {
inForm_Resize = true;

[Code] ....

View 3 Replies


ADVERTISEMENT

C# :: Custom Dialog Resizer With Aspect Lock CheckBox

Jan 20, 2015

I am working on a paint program (already quite well developed) and I have a 'Resize' option in my Menu. When pressed it activates a custom dialog for resizing the image with 2 numeric up/downs to adjust width and height. It all works perfectly. But I want to include an 'Aspect Lock' checkBox like a professional program would have. It should immediately change both values as you adjust either one.

Here's where I am totally stumped! Of course I have tried and tried various codes, but nothing works properly. My values jump erratically or won't change at all. I wonder if trying to change the value of one numeric up/down while inside the code block for changing the value of the other one has got them screwing with each other somehow. Any example code that could accomplish what I'm trying to do?

View 5 Replies View Related

C++ :: Print Out The Ratio Max / Min?

Aug 15, 2014

Given three integers, print out the ratio max/min

#include <iostream>
using namespace std;
int main(int x,int y,int z,int max,int min)

[Code].....

My Dev++ App in error

View 1 Replies View Related

C :: Computing Ratio With Array?

Feb 10, 2014

What is wrong with this code cause im not getting the correct ratio of total people to cumulative length?

Code:
#include<stdio.h>
#include<stdlib.h>
//define constant variables
#define FIRST_CAR_LENGTH 10
#define NORMAL_CAR_LENGTH 8
#define CAR_CAPACITY 4
int main(void){
//Set up some variable with values that come from input or calculations

[Code].....

View 7 Replies View Related

C++ :: How To Compute Financial Ratio With Using Header File

Aug 19, 2013

How to compute financial ratio in C++ with using header file?

Calculate in c++ program with 3 different file. - 2 file (cpp file) - 1 file (header file)

Information:

formula:-
*1.*Current ratio = (current asset / current liabilities)
*2.*Gross margin = (Revenue – Cost of goods sold) / Revenue
*3.*Operating margin= (Operating Income / Revenue)
*4.*Profit margin = (Net Profit / Revenue)
*5.*ROE= (Net Income/Shareholder's Equity)

I want put 5 formula to run the program. How to put 5 formula in the program but run one formula.

EXAMPLE: In the coding, write all financial ratio. When we compile, just asking 1 formula value only. We need to fixed, which formula to run. Just adjust the coding only.

View 7 Replies View Related

C Sharp :: Create Instance Of Form Into Non Form Class To Access Button / Label

Nov 23, 2014

I have a non form class. I want to update label/ check status of check box etc.. in non form class ( here resides functions that contains logic). How can i do that ?

View 4 Replies View Related

C# :: How To Access User Control Form One Of The Child Form

Apr 22, 2014

I hav created mdi parent form that contain one user control. I want to access that user control from one of the child form

View 4 Replies View Related

C# :: Login Then Close Form And Open Main Form

Aug 25, 2014

This is more of a Application Design question, Let's say I have Form1(Login), this is opened from Program.cs, when the user enters details, the Event Handler makes a instance of a class, adds the data and stores the instance within Program.cs class.

So the best thing to do here, is to close the Form1(Login) and open Form2(Main) via Program.cs so that I can send the List<Login> object with my Login instance objects to said form. This form will remain open throughout the applications use as it's like the main GUI for all the programs functions.

When I close this form, I may want to save some information before the application is terminated, so I may as well store the Login instances in Program.cs anyway.

Main stepping stone: Multiple (usually around 3 max) users can login this system if need be, which will mean closing Form2(Main) and then opening Form1(Login) so that once Form1 is closed it can recreate the From2(Main) form and pass the new List<Login> to that form.

What's the best way to do this, at the moment i'm creating the Form2 instance like so:

//....
//Detect the Login form being closed
loginForm.Closed += new EventHandler(OnLoginClosed);
//...
//Open the main form when the login is closed
private void OnLoginClosed(object sender, EventArgs e)

[Code] .....

This seems like it will work and do the job, but is there a better and cleaner way? The List<Login> will be passed to Forms which are created via Form2(Main) as this information will be needed. It's just that ive been told not to use Forms for too much data containment.

View 2 Replies View Related

C# :: Sharing Variables From Login Form To Another Form

Mar 10, 2015

I have a form with 2 text boxes (Email and Password)

The user fills in the text boxes and clicks on the Log in button. The code behind the log in button does the following, First connects to a table (Users) in phpmyadmin. Next runs a SQL query (SELECT * FROM `users` WHERE Email = '" + sEmail + "' AND Password = '" + sPassword + "'") sEmail being the variable created from the text entered in Email text box and the same for password.

Next if the record count == to 1 it opens up the main menu form and if the record count == 0 it fails and the user does not get to the main menu.

All of the above is fine and working however what I want to do is take over a variable from the log in form to the other forms.

The code is below for the sign in button as all my code is behind that (I think this may be where I'm going wrong).

public partial class WelcomeForm : Form{
public static string connStr = "server = localhost; " +
"database = ppw5; " +
"uid = James; " +
"pwd = buster;";

[Code] .....

And the Main menu form where I'd like to take a variable over with me, lets assume the variable is the UserID from the database table that I pull from the dTable I created.

public partial class MenuForm : Form {
//Call the CloseProgram class and create a new method called ClassClose.
CloseProgram ClassClose = new CloseProgram();
WelcomeForm User = new WelcomeForm();
public MenuForm() {
InitializeComponent();

[Code] .....

View 7 Replies View Related

C :: Can't Get Array To Resize

Jan 6, 2015

I have an array of blocked users and I want to be able to increase the element size every time a new user is to be blocked.

The blockedUsers array and blockedCount int are global varaibles

Code:
int blockedCount = 0;
char ** blockedUsers; Code: int blockUser(char *username)
{
int i = 0;

[Code]....

View 11 Replies View Related

C :: Resize A Bitmap Image

Aug 22, 2014

I am trying to re-size a bitmap image for a class.They gave us two options to use to do the program with: an array or move the file position indicator. I want to use the file option. All the bitmap header info is checking out. The file after being re-sized should be 822 bytes but it is 1.6 KiB and the image is distorted.

Code:

#include <stdint.h>
/**
* Common Data Types
*
* The data types in this section are essentially aliases for C/C++
* primitive data types.

[Code]...

View 2 Replies View Related

C# :: Calling Method In One Form From Another Form?

Dec 6, 2014

I have a program which when a button is clicked on Form1 it runs a vision system operation on an image in a window on a Form1. There are also other buttons on the Form1 which can change things like threshold levels so the inspection can be run again with different settings. It all works fine but I want to change it to remove the buttons from Form1 so that when the user clicks on a button on Form1 it opens up another form, Form2, and all the buttons which were on Form1 are now on Form2 and the image analysis should run on Form1 when the buttons are used on Form2. I have taken over all the code from Form1 to Form2 and I'm trying to make this happen by creating a new oject on Form1 which calls a method on Form2 which contains the code which was in Form1 and called when the button was clicked on Form1 - not working!! I have a constructor in Form2 but I think I have become monumentally confused.

This was the code which was on Form1 when the inspection button was clicked.

private void cmdInspectOnce_Click(object sender, EventArgs e)
{
iReturn = VisionSystem.InvModeSet(IpeEngCtrlLib.I_MODE.I_EXE_MODE_ONCE);
if (_imgEngines!=null && _imgEngines[0]!=null)
_imgEngines[0].cmdInspectOnce();//InvModeSet(IpeEngCtrlLib.I_MODE.I_EXE_MODE_ONCE);
}

View 1 Replies View Related

C# :: Selection From 1 Form DatagridView On Second Form

Sep 5, 2014

I have 3 Windows Form: frmMain, frmFirstForm, and frmSecondForm.

frmMain is the form that will load when the application is started with 2 tabs to access frmFirstForm and frmSecondForm.

Here's my problem:

After making a selection from a combobox on frmFirstForm, I would like a datagridview header to change based on the selection made. Here is a list of items on one combobox: Item1, Item2, Item3, Item4. When somebody chooses Item one, the header on the datagridview on frmSecondForm should display: JohnItem1, PaulItem1, BradItem1 and so on. Those items are not part of the comboboxes, but they will be shown as header text on the datagridview on the second form either automatically or after clicking OK from frmMain. There's no OK button on frmFirstForm, but on frmMain.

The only code I have right now is the if statement on the form load on frmSecondForm. Here's what I have:

private void HeaderTextLoad() {
if(comboboxonfirstform.text = "Item1") {
datagridview1.Columns[0].HeaderText = "ItemJohn";
datagridview1.Columns[1].HeaderText = "ItemPaul";
... And so on.
}
}

View 1 Replies View Related

C++ ::  Dynamic Array Resize Function

Apr 22, 2014

I made a resize function for my dynamic array template class that goes as follows. Note that the private member variables are T* arr, unsigned used, and unsigned cap.

template <class T>
void darray<T>::resize(unsigned size) {
if (size > cap) {
T* temp_arr = new T[size];

[Code] ....

Whenever I use this function to increase the size of the array, it will work the first time I need to use it, but after that, Visual Studios will trigger a breakpoint at line 14, and if I continue past the breaks, I eventually get _CrtIsValidHeapPointer(pUserData) assertion failure.

View 4 Replies View Related

C++ :: Vector Syntax - Resize And Reserve

Mar 7, 2014

We can construct vector in following ways

vector<int>v1; //create an empty vector
vector<int>v2(arr,arr+4); ///to create vector from an array
vector<int<v3(v2); //throuh copy constructor

But I have come across some program in a forum,they have create vector like this

vector<int>v(10,5)

I am clueless ,is this allowed?,what syntax allows this?

if a vector is create like this

vector<int>v(3);
v.push_back(1);
v.push_back(2);
v.push_back(3)
v.resize(2);

Now I am curious to know what are the changes those will happen in vector v because of resizing it?

View 1 Replies View Related

C++ :: Set Vector Step Length When Resize?

Jan 5, 2013

When I use vectory.push_back(obj), if the length is out of reserved bound, it will deallocate the whole vector and reallocate a big piece of memory. From my understanding I think c++ only allocates 1 more place for the new obj. This is quite inefficient. Is there a way to set the step length whenever the size is out of bound? e.g. 50 more spaces.

View 6 Replies View Related

C# :: Resize Quadrilateral Image According To New Points

Nov 22, 2014

I have a bit map which I wants to re-size according to new point. But on Paint Event Method getting error not Implemented.

CODE Under Paint Event Method

private void pictureBox3_Paint(object sender, PaintEventArgs e) {
Point[] destinationPoints = {new Point(200, 20),new Point(110, 100),new Point(250, 30), new Point(250, 30) };
Image image = new Bitmap("D:\APP\Resources\MyPic.Png");
// Draw the image mapped to the parallelogram.
e.Graphics.DrawImage(image, destinationPoints);
}

View 5 Replies View Related

Visual C++ :: CDialog Resize In One Direction

Oct 27, 2014

Is there any way to allow user to resize a CDialog only in one direction ? I mean, by width, but not by height ? How ? I noticed that overriding WM_SIZE, I can do nothing about this issue ...

View 2 Replies View Related

Visual C++ :: Program To Resize Image?

Feb 19, 2013

I am currently working on problem set 4 for Harvard's online CS50 course. I am working on a program that resizes a bmp image by a factor of N. N in entered along with an in-file and out-file in a command line argument. The program needs to calculate the header file for the out-file and write it to the out-file. It then needs to actually resize the image and, again, write to the out-file.

The first question I have relates to the header file, here is my code for calculating the header file:

bi2.biHeight = bi.biHeight *n;
bi2.biWidth = bi.biWidth *n;
int padding = (4 -(bi.biWidth * sizeof(RGBTRIPLE))%4)%4;
bi2.biSizeImage = (bi2.biWidth * sizeof(RGBTRIPLE) + padding) * abs(bi2.biHeight);
bf2.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bi2.biSizeImage;

And here is my code for writing the new header file (bi2 and bf2) to the out-file:

fwrite(&bf2, sizeof(BITMAPFILEHEADER), 1, outptr);
fwrite(&bi2, sizeof(BITMAPINFOHEADER), 1, outptr);

At this point I need to actually resize the image. As far as I can tell there are 2 ways to go about this you either have to use an array to store each line you want to print repeatedly (and then you can just write it repeatedly) OR you have to move the pointer back in the input stream and repeat the read/resize/write process each time you need to print the row.

It is this that I am stuck on, first of all, I am not sure what system would be better for resizing the image, although I am leaning towards using an array, and regardless, I don't even know where to begin when in implementing either.

So what I am asking for is, first of all, just a "double check" to make sure my header code makes sense. And second of all, a push in the right direction for actually resizing the image. Here is my complete code:

/****************************************************************************
* resize.c
*
* Resizes a BMP piece by piece, just because.
***************************************************************************/

#include
#include
#include "bmp.h"
int main(int argc, char* argv[]) {
// ensure proper usage
if (argc != 4) {
printf("Usage: copy N infile outfile

[Code]....

View 7 Replies View Related

C# :: Create GUI Application That Can Resize Also Control Buttons?

May 23, 2012

how can I create a GUI application that can resize also the control buttons. If the user decide to make the windows bigger or smaller I would like my textbox, buttons, etc.. to follow. Like in Java they use a layout manager, but I can't seem to find the answer for c#. I though to use table layout panel, but it doesn't expand when expanding the windows, unless i miss something

View 3 Replies View Related

C++ :: Make Resize Function For Matrix2 Class?

Aug 29, 2013

class Matrix1
{
Protected:
int ** data;

[Code].....

// How can we write resize function for Matrix2 class; where this function need to use Protected data members of matrix1 class? Only setters are available in Matrix 1 class but there is no getter function in Matrix1 class !

View 1 Replies View Related

C/C++ :: Make Resize Function For Matrix2 Class?

Aug 29, 2013

How can we write resize function for Matrix2 class; where this function need to use Protected data members of matrix1 class? Only setters are available in Matrix 1 class but there is no getter function in Matrix1 class !

class Matrix1 {  
Protected:
int ** data;

[Code]....

View 3 Replies View Related

C++ :: Resize Array - No Constructor Could Take The Source Type

Apr 25, 2013

i have 1 class with several class's and 1 structure:

Code:
struct Images {
HBITMAP ImageImage;
BITMAP Imagebm;
HDC ImagehdcMem;
HBITMAP ImageMaskImage;

[Code] .....

But I get these error:
"--------------------Configuration: Sprite2 - Win32 Debug--------------------
Compiling...

Test Sprite2.cpp
C:UsersJoaquimDocumentsVisual C 98Sprite2Test Sprite2.cpp(23) : error C2440: 'type cast' : cannot convert from 'void *' to 'struct Images'
No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.

Sprite2.exe - 1 error(s), 0 warning(s)"

I try search more code, but i get more errors ...

View 14 Replies View Related

C :: Dynamic Memory Allocation - Resize Array Of Pointers

May 23, 2013

Suppose I wished to reallocate memory (resize) an array of pointers. Why does the following not work?(The program runs, yet yields a faulty segmentation error message. Why?):

Code: char **ptrarr = (char**) malloc(sizeof(char*))

Code: ptrarr = (char**) realloc(ptrarr, (capacity) * sizeof(char*));

View 14 Replies View Related

Visual C++ :: Resize Property Sheet / Page Dialogs

May 17, 2014

any easy way to resize property sheet/page dialogs automatically or semi automatically?. have tried too many stuff, but none were fruitful.

View 5 Replies View Related

C++ :: How To Convert Compact Form Of Matrix Into Matrix Form

Oct 4, 2014

3 3
2 1 3 2 3
1 0 2
1 2 6

First line shows row and column number

First index of the second line tells the number of non-zero entries of the first row and second index tell the column number where the non zero entry is placed

for 1st row of matrix:

non-zero entries=2
column number=1
non-zero entry=3
column number=2
non-zero entry=2

covert this in the given form
0 3 3
2 0 0
0 0 6

View 1 Replies View Related







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