第一印象
範例程式
截圖
與其它函式庫比較
相關應用
下載
Documentation
作品展示(Bazaar)
現狀及發展藍圖
常見問題(FAQ)
作者與授權
論壇
資助Ultimate++
搜尋本網站
語言
中文(繁體)











SourceForge.net Logo



DropFiles

 

Window that accepts drag&drop of files

 

 

main.cpp

 

#include <CtrlLib/CtrlLib.h>

 

using namespace Upp;

 

struct DndTest : public TopWindow {

    virtual void Paint(Draw &w);

    virtual void DragAndDrop(Point p, PasteClip& d);

    virtual bool Key(dword key, int count);

    Vector<String> files;

 

    DndTest();

};

 

void DndTest::Paint(Draw &w)

{

    w.DrawRect(GetSize(), SColorPaper());

    if(files.GetCount())

        for(int i = 0; i < files.GetCount(); i++)

            w.DrawText(2, 2 + i * Draw::GetStdFontCy(), files[i]);

    else

        w.DrawText(2, 2, "None");

}

 

void DndTest::DragAndDrop(Point p, PasteClip& d)

{

    if (AcceptFiles(d)) {

        files = GetFiles(d);

        Refresh();

    }

}

 

bool DndTest::Key(dword key, int count)

{

    if(key == K_CTRL_V) {

        files = GetFiles(Ctrl::Clipboard());

        Refresh();

        return true;

    }

    return false;

}

 

DndTest::DndTest()

{

    Title("I need files!");

}

 

GUI_APP_MAIN

{

    DndTest().Run();

}

 

 

 

 

本頁也正在english, català, čeština, deutsch, español, euskara, français, română, русский中文(简体)中. 你想幫忙嗎?