Add scrollbar example

This commit is contained in:
haru-s 2024-04-14 11:34:11 +09:00
parent 86c88840e9
commit 000ba4ea27
10 changed files with 128 additions and 1 deletions

View file

@ -25,6 +25,7 @@ DFL is a Win32 windowing library for the D language.
![screen shot](./examples/listview/image/screenshot.png "screen shot")
![screen shot](./examples/statusbar/image/screenshot.png "screen shot")
![screen shot](./examples/splitter/image/screenshot.png "screen shot")
![screen shot](./examples/scrollbar/image/screenshot.png "screen shot")
![screen shot](./examples/imagelist/image/screenshot.png "screen shot")
![screen shot](./examples/commondialog/image/screenshot.png "screen shot")
![screen shot](./examples/commondialog/image/screenshot2.png "screen shot")
@ -41,7 +42,7 @@ DFL is a Win32 windowing library for the D language.
![screen shot](./examples/dclock/image/screenshot.png "screen shot")
![screen shot](./examples/tablerenderer/image/screenshot.png "screen shot")
![screen shot](./examples/linegraphrenderer/image/screenshot.png "screen shot")
![screen shot:w200](./examples/timechartrenderer/image/screenshot.png "screen shot")
![screen shot](./examples/timechartrenderer/image/screenshot.png "screen shot")
## Build and Install (dfl.lib and dfl_debug.lib)
### 1. Set environment variables

16
examples/scrollbar/.gitignore vendored Normal file
View file

@ -0,0 +1,16 @@
.dub
docs.json
__dummy.html
docs/
/hello_dfl
hello_dfl.so
hello_dfl.dylib
hello_dfl.dll
hello_dfl.a
hello_dfl.lib
hello_dfl-test-*
*.exe
*.pdb
*.o
*.obj
*.lst

13
examples/scrollbar/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (Windows) scrollbar",
"type": "cppvsdbg",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "./bin/scrollbar.exe",
"console": "internalConsole"
}
]
}

20
examples/scrollbar/.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "dub",
"run": false,
"cwd": ".",
"compiler": "$current",
"archType": "$current",
"buildType": "$current",
"configuration": "$current",
"problemMatcher": [
"$dmd"
],
"group": "build",
"label": "dub: Build scrollbar_example",
"detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application"
}
]
}

View file

@ -0,0 +1,2 @@
# Screen Shot
![screen shot](./image/screenshot.png "screen shot")

View file

@ -0,0 +1,16 @@
{
"authors": ["haru-s"],
"copyright": "Copyright (C) 2024 haru-s",
"description": "DFL sample code.",
"name": "scrollbar",
"targetType": "executable",
"targetPath": "bin",
"dependencies": {
"dfl": {
"path": "../../../dfl"
}
},
"lflags-windows-x86_omf-dmd": ["/exet:nt/su:windows:6.0"],
"lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"],
"lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,12 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"d.projectImportPaths": [
"..\\..\\..\\dfl\\source"
]
}
}

View file

@ -0,0 +1,3 @@
set dmd_path=c:\d\dmd2\windows
set dmc_path=c:\dmc\dm
cmd

View file

@ -0,0 +1,44 @@
import dfl;
version(Have_dfl) // For DUB.
{
}
else
{
pragma(lib, "dfl.lib");
}
class MainForm : Form
{
private Label _label;
public this()
{
this.text = "Scrollbar example";
this.size = Size(400, 200);
this.hScroll = true;
this.vScroll = true;
Rect bounds = Screen.primaryScreen.bounds;
this.scrollSize = Size(bounds.width, bounds.height);
_label = new Label;
_label.text =
"Long long long long long long long long long\n" ~
"long long long long long long long long long\n" ~
"long long long long long long long long long\n" ~
"long long long long long long long long long text";
_label.autoSize = true;
_label.location = Point(50, 50);
_label.parent = this;
}
}
static this()
{
Application.enableVisualStyles();
}
void main()
{
Application.run(new MainForm());
}