The video I followed is: https://www.youtube.com/watch?v=42jJDAfFVfI
The excerpts I'm specifically working with are below. Everything else works fine. The code in question (in it's entirety) I've tried to attach using tar and zip and it states http error, if needed pls message me.
Code: Select all
void My_Image_wxFrame::OnCopyClick(wxCommandEvent& event)
{
wxBitmap my_bitmap_tmp(Panel1->GetSize(), wxBITMAP_SCREEN_DEPTH);
my_wxmemorydc->SelectObject(my_bitmap_tmp);
my_wxmemorydc->Blit(wxPoint(0,0),Panel1->GetSize(),my_wxclientdc,wxPoint(-1,-1),wxCOPY,true,wxDefaultPosition);
if (wxTheClipboard->Open())
{
wxTheClipboard->AddData(new wxBitmapDataObject(my_bitmap_tmp));
wxTheClipboard->Close();
}
}
void My_Image_wxFrame::OnSaveAsClick(wxCommandEvent& event)
{
wxBitmap my_bitmap_tmp(Panel1->GetSize(), wxBITMAP_SCREEN_DEPTH);
my_wxmemorydc->SelectObject(my_bitmap_tmp);
my_wxmemorydc->Blit(wxPoint(0,0),Panel1->GetSize(),my_wxclientdc,wxPoint(-1,-1),wxCOPY,true,wxDefaultPosition);
int dlg=FileDialog2->ShowModal();
if(dlg==wxID_OK)
{
wxFileName my_file(FileDialog2->GetPath());
wxString my_file_ext=my_file.GetExt().Lower();
if(my_file_ext==wxT("xpm"))
my_bitmap_tmp.SaveFile(FileDialog2->GetPath(),wxBITMAP_TYPE_XPM,NULL);
else if(my_file_ext==wxT("jpeg"))
my_bitmap_tmp.SaveFile(FileDialog2->GetPath(),wxBITMAP_TYPE_JPEG,NULL);
else if(my_file_ext==wxT("bmp"))
my_bitmap_tmp.SaveFile(FileDialog2->GetPath(),wxBITMAP_TYPE_BMP,NULL);
else wxMessageBox(wxT("Extension ERROR"),wxT("ERROR"));
}
}