|
You can first calculate the target image's size based on all the small images' sizes, then create a blank image of the target size in memory. After that, load the small images one by one into memory, then render them to appropriate locations in the target image in memory.
For this purpose, the GDI+ Image class is your friend. If you like the old method, then device independent bitmap (DIB) can be used instead.
There are some useful information in MSDN Magazine. They are freely available online. For example, Paul DiLascia has some open source utilities that can be used in your project.
Hope this helps. Happy programming!
|
|
|
|
|
loyal ginger wrote: You can first calculate the target image's size based on all the small images' sizes, then create a blank image of the target size in memory. After that, load the small images one by one into memory, then render them to appropriate locations in the target image in memory.
For this purpose, the GDI+ Image class is your friend. If you like the old method, then device independent bitmap (DIB) can be used instead.
Rather than using image classes or DIBs and rendering into the new image, an alternative would be to use DIBSections. This would allow access to the raw pixel data, which could then be copied (and manipulated in any desired manner in the process) directly into the target pixels, avoiding the complexities of creating memory DC's, selecting images into them, blitting, inadvertently creating GDI resources leaks, etc, etc.
And I'm afraid Paul DiLascia, writer of PixieLib and countless invaluable MSDN articles, is no more.
|
|
|
|
|
Are you asking how you can open the two files and access their pixels directly? Because that's the part we can tell you quite easily. coming up with the algorithm for merging them is up to you.
|
|
|
|
|
it is easy to do.
Overview: create a big enough target image and copy all source images in it. Use the right coordinates for that. Than save and done.
This fine article should help: ImageStone[^]
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Howdy'
(for VS2008 + MFC Feature Pack)
When a menu contains too many items to fit the screen (or available space), it displays buttons to scroll the menu up and down to show hidden menu items.
Is there a name for these buttons or existing controls ?
Thanks.
Max.
This signature was proudly tested on animals.
|
|
|
|
|
Such scrollable menu is bad design. Users really dont like it. You should avoid it.
Use spy++ to look for details...
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I have a Visual Studio 2008 C++ CLR Windows Form application. The Windows Form has a Timer (timer1), a Status Strip (statusStrip1) which has a label (toolStripStatusLabel1) and a Text Box (textBox1). I am trying to display the local system time (localtime_s) in the Status Strip label (toolStripStatusLabel1). I enabled the Timer (timer1) and added the Timer function time1_Tick) to the Load event of the Windows Form. The application complies with no compiler or link errors. I also inserted some debug code to show the local system time in a Text Box (textBox1) to confirm that the local system time is working. It is. However, the local system time never appears in the Status Strip label (toolStripStatusLabel1). How do I fix this? Please be gentle. I am learning Visual C++. Here is the code:
private:
System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
time_t t = time(NULL);
tm s;
localtime_s(&s, &t);
String^ str = " ";
if (s.tm_hour < 13)
str = "AM";
else
str = "PM";
System::Windows::Forms::StatusStrip toolStripStatusLabel1;
toolStripStatusLabel1.Text = String::Format("{0}:{1}", s.tm_hour,
s.tm_min, str);
textBox1 -> Text = String::Format("{0}:{1} {2}", s.tm_hour,
s.tm_min, str);
}
|
|
|
|
|
I think you may need to force a refresh of your form to get the toolStripStatusLabel to repaint itself. Silly, I know, but ...
|
|
|
|
|
I simplified the code for getting the local system time and added a refreseh for the form, but it still isn't showing the local system time in the Status Stril Label.
<br />
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)<br />
{<br />
DateTime^ thisDate = DateTime::Now;<br />
System::Windows::Forms::StatusStrip toolStripStatusLabel1;<br />
toolStripStatusLabel1.Text = String::Format("{0:t}", thisDate);<br />
Form1::Refresh();<br />
}<br />
|
|
|
|
|
spicture wrote: System::Windows::Forms::StatusStrip toolStripStatusLabel1;
toolStripStatusLabel1.Text = String::Format("{0:t}", thisDate);
I think I see what may be wrong; you are creating a temporary System::Windows::Forms::StatusStrip and setting its text, but it is not a child of your form. You need to update the status strip that is defined on your form.
|
|
|
|
|
Thank you. I finally got it. Here is the code.
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
DateTime^ thisDate = DateTime::Now;
System::Windows::Forms::StatusStrip toolStripStatusLabel1;
Form1::toolStripStatusLabel1 -> Text = String::Format("{0:f}", thisDate);
}
|
|
|
|
|
Thnak you. I fianlly gor it. Here is the code.
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
DateTime^ thisDate = DateTime::Now;
System::Windows::Forms::StatusStrip toolStripStatusLabel1;
Form1::toolStripStatusLabel1 -> Text = String::Format("{0:f}", thisDate);
}
|
|
|
|
|
spicture wrote: System::Windows::Forms::StatusStrip toolStripStatusLabel1;
This line is redundant; you are creating a temporary object but never using it.
|
|
|
|
|
Instead of time, if you put a fixed text string in there, does it show?
|
|
|
|
|
Yes. If I added text to the Status Strip Label's property it shows when the application is run. I have simplified how to get the local system time, but that has not helped.
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
DateTime^ thisDate = DateTime::Now;
System::Windows::Forms::StatusStrip toolStripStatusLabel1;
toolStripStatusLabel1.Text = String::Format("{0:t}", thisDate);
textBox1 -> Text = String::Format("{0:t}", thisDate);
}
|
|
|
|
|
Thank you. I finally got it. Her is the code.
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
DateTime^ thisDate = DateTime::Now;
System::Windows::Forms::StatusStrip toolStripStatusLabel1;
Form1::toolStripStatusLabel1 -> Text = String::Format("{0:f}", thisDate);
}
|
|
|
|
|
here is the code:
int _xC,_yC;
void OnMouse(int button, int state, int x, int y)
{
int xMax = glutGet(GLUT_WINDOW_WIDTH);
int yMax = glutGet(GLUT_WINDOW_HEIGHT);
_xC = x;
_yC = yMax-y;
}
with this code , left click get xC and yC.
use this, i want to make Point array to save x-axis and y-axis of point which is defined by left click by Onmouse code.
but how to stop???
can i use right click or double click to break ???
|
|
|
|
|
hi all,
i am creating an application in which i want to write the content into an excel.
i have two doubts here.
doubt #1
i am actually using CFile.write function to write data into an excel. but,if i happen to write second time into the excel, it is overwriting the first item instead of appending it to the excel as second item. what should we do for this?
myfile.Open("example.xls",CFile::modeCreate|CFile::modeWrite, NULL);
myfile.Write(sUserID,sUserID.GetLength());
doubt #2
while writing in an excel, i have got three parameters to be written. (name,age and sex). all these three parameters are written in one cell. how to write them in a separate cells?
Thanks for your help in advance..
Rakesh.
|
|
|
|
|
Sounds like you need to move the file pointer on after the write. There's probably a method of CFile to do this, just pass it the GetLength() value. If you don't the pointer stays pointing to the 0 position in the file so the next write will overwrite the previous.
|
|
|
|
|
hi jonathan,
thanks alot for your reply..
can u please teach me how to pass the pointer using the getlength method?
thanks once again for patiently replying..
rakesh.
|
|
|
|
|
|
The file pointer gets updated automatically on a read or write operation. The next write to the same file will be positioned after the first write's data.
|
|
|
|
|
Rakesh5 wrote: CFile::modeCreate
You are recreating the file each time with new content using that flag.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
After you open the file, use the SeekToEnd function:
myfile.Open("example.xls",CFile::modeCreate|CFile::modeWrite, NULL);
myfile.SeekToEnd();
myfile.Write(sUserID,sUserID.GetLength());
I can't say that I've ever seen anyone use CFile to write to an excel file, so I'm not sure how you're accomplishing that. Most people would write the data to a .csv file, which can then be opened in excel. Each cell data on the same line would be separated by a comma, with a CR/LF pair at the end of that line.
I don't think you're actually creating a true .xls file - it's most likely just a text file, but with the .xls extension, excel may be able to open it.
Be aware that just because you name a file with .xls as an extension, it's not really an Excel file.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
hi,
thanks alot for your info..
i tried using seektoend function. but it is still overwriting the value..
can u please help me to solve this problem?
and i don understand how to write each value in each cell? can u explain me little more?
thanks,
rakesh.
|
|
|
|